Results 1 to 7 of 7
  1. #1

    Default ParticleSystem (Beam) - change location, set beam in straight line?

    Hi guys,

    I have some problems with a particle system and I hope you can help me.
    First off a little video to show you my problem:



    1. I want the tower to shoot in a straight line at the enemy. I'm currently using the 'WP_LinkGun.Effects.P_WP_Linkgun_Altbeam' for this effect. How can I do this? All the FiringComponent.Set[...] functions don't seem to work.

    2. I would like to change the location of the emitter after spawning. So that I can correct the location, when the Tower has turned its direction. I also didn't figure out how to do this yet.

    3. I tried to reuse the same ParticleEmitter with "DeactivateSystem" and activating it again by "ActivateSystem", but it didn't work. So I guess the Emitter is killed automatically, when I'm using "DeactivateSystem". Am I right?

    Here is my code:

    Code:
    var ParticleSystemComponent FiringComponent;
    var ParticleSystem FiringSystem;
    var Vector FiringLocation;
    [...]
    state Attacking
    {
    	simulated event BeginState(name PreviousStateName)
    	{
    		[...]
    		FiringLocation = OwnerTower.Location + Vector(OwnerTower.Rotation)*30;
    		FiringLocation.Z+=50;
    		FiringComponent = WorldInfo.MyEmitterPool.SpawnEmitter(FiringSystem, FiringLocation);
    		FiringComponent.SetVectorParameter('LinkBeamEnd', Target.Location);
    		FiringComponent.SetDepthPriorityGroup(SDPG_World);
    	}
    
    	simulated event EndState(name NextStateName)
    	{
    		WorldInfo.Game.Broadcast(self,"Laser leaving State Attacking");
    		FiringComponent.DeactivateSystem();
    	}
    
    	event Tick(float DeltaTime)
    	{
    		[...]
    		FiringLocation = OwnerTower.Location + Vector(OwnerTower.Rotation)*30;
    		FiringLocation.Z+=50;
    		FiringComponent.SetVectorParameter('LinkBeamEnd', Target.Location);
    		FiringComponent.SetBeamDistance(-1, VSize(FiringLocation-Target.Location));
    		[...]
    	}
    }

  2. #2
    Banned
    Join Date
    Feb 2011
    Location
    BXL/Paris
    Posts
    2,169

    Default

    This happen because of GetAdjustedAim in Weapon...

    ...or if this is not a weapon class, responsible is your Tick: FiringComponent.SetVectorParameter('LinkBeamEnd', Target.Location);
    Last edited by VendorX; 04-30-2012 at 03:43 AM.

  3. #3

    Default

    Quote Originally Posted by VendorX View Post
    This happen because of GetAdjustedAim in Weapon...

    ...or if this is not a weapon class, responsible is your Tick: FiringComponent.SetVectorParameter('LinkBeamEnd', Target.Location);
    Its not a Weapon Class. The logic of the tower which enemy is hit is independent of the visual representation. So I have the start and the end coordinates of the beam.
    But it seems to me, that the ParticleSystem is "too long" for this given distance, so the udk is drawing a curve to display it.

    The second problem is the start location. It is set once, when spawning the Emitter "WorldInfo.MyEmitterPool.SpawnEmitter(FiringSystem , FiringLocation);" but I don't know how to change it after this.
    So what I look for is a method like: FiringComponent.SetLocation(FiringLocation), but I can't find something like this. I could spawn a new Emitter every tick, but I don't think this would be the best option. ^^

  4. #4
    Banned
    Join Date
    Feb 2011
    Location
    BXL/Paris
    Posts
    2,169

    Default

    Quote Originally Posted by Swarles87 View Post
    But it seems to me, that the ParticleSystem is "too long" for this given distance, so the udk is drawing a curve to display it.
    They're not attached and can't rotate... Attach your FiringComponent to bone/socked and set:
    FiringComponent.bUpdateComponentInTick = true;

    Quote Originally Posted by Swarles87 View Post
    The second problem is the start location. It is set once, when spawning the Emitter "WorldInfo.MyEmitterPool.SpawnEmitter(FiringSystem , FiringLocation);" but I don't know how to change it after this.
    So what I look for is a method like: FiringComponent.SetLocation(FiringLocation), but I can't find something like this. I could spawn a new Emitter every tick, but I don't think this would be the best option. ^^
    When attached, you not need to worry about... Use new instead of MyEmitterPool...
    Last edited by VendorX; 04-30-2012 at 08:51 AM.

  5. #5
    Palace Guard
    Join Date
    Aug 2008
    Location
    Location,Location
    Posts
    3,721

    Default

    Did you try making your own particle system beam and trying that instead? The Link beam always had curves to it when firing it may just be the particle system.

  6. #6

    Default

    Thanks guys! I now got it to work.



    Here the solution, if other people have the same problem.



    Code:
    simulated event PostBeginPlay()
    {
    	FiringComponent.DeactivateSystem();
    }
    state Attacking
    {
    	simulated event BeginState(name PreviousStateName)
    	{
                    [...]
    		if(bEmitterIsAttached==false)
    		{
    			OwnerTower.TurretMesh.AttachComponentToSocket(FiringComponent, 'FireLocation');
    			FiringComponent.bUpdateComponentInTick = true;
    			FiringComponent.SetDepthPriorityGroup(SDPG_World);
    			bEmitterIsAttached=true;
    		}
                    [...]
    		FiringComponent.SetVectorParameter('LinkBeamEnd', Target.Location);
    		FiringComponent.ActivateSystem();
    	}
    
    	simulated event EndState(name NextStateName)
    	{
    		FiringComponent.DeactivateSystem();
    	}
    
    	event Tick(float DeltaTime)
    	{
    		FiringComponent.SetVectorParameter('LinkBeamEnd', Target.Location);
    	}
    }
    DefaultProperties
    {
    	bEmitterIsAttached=false
    	Begin Object Class=ParticleSystemComponent Name=ParticleSystemComponent1
                Template=ParticleSystem'TDParticleEffects.Beam'
            End Object
    
            FiringComponent=ParticleSystemComponent1
            Components.Add(ParticleSystemComponent1)
    }

  7. #7
    MSgt. Shooter Person
    Join Date
    Feb 2011
    Location
    Ventrilo
    Posts
    158

    Default

    As far as i know this is due to the "Target" node in the particle system.
    Try playing around with lock radius, lock strength, target strength, target tangent and "lock absolute".

    edit: oh way slow there


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.