How to get a particle emitter to stick to a point on an actor

FiredangerFiredanger Member Posts: 3
edited May 2012 in Working with GS (Mac)
I cannot find a solution to getting a particle emitter to stay in the same position of an actor that spawns it.
For example:
A particle emitter that is spawned and has the constrained attributes to be -100X by -100Y from the actor that spawns it, the emitter stays to the southwest of the spawning actor just fine. But when the spawning actor rotates to the left the emitter stays to the southwest and will not revolve around the actor.

I found several posts about joints, followed their directions with no success. Any assistance would be greatly appreciated.

Best Answer

  • PhoticsPhotics Posts: 4,172
    edited May 2012 Accepted Answer
    Hi.

    If you look closely at the video for BOT... http://photics.com/bot ...you can see particles emitting from a specific — and rotating — actor point.

    This is accomplished with cos/sin.

    Here's an example with one of the exploded Wasp bits...
    Emitter Offset...
    X = cos( self.Rotation )*16
    Y = sin( self.Rotation )*16

    This kind of stuff is explained in greater detail in my textbook. But basically, when cos/sin is used together can make a circle. By using trigonometry, you can get your particles to spin with your actor's rotation.

Answers

  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    Look up "how to constrain an actors position to anothe actor" on YouTube and tab's video should come up
  • FiredangerFiredanger Member Posts: 3
    Thank You Photics,

    The effect I am after is I believe like that of the wasp parts. I never did learn trigonometry...
    I've tried implementing your formulas in different ways into my project with no success.

    Are the X and Y above game attributes? And if so are they integer, real or?
    And is the *16 part of the Trigo math or a measurement in your game?

    My project is a small tank. When it drives I wanted a particle emitter at the back of each tread...
    The tank is 50x50 and the emitter should be spawned at -20X by -22Y to look right.

    So I made integer game attributes called M1X and M1Y.
    The tank chasis has two constrain attributes that read:
    (game.M1X) To: cos( self.Rotation )-20 [or*16]
    (game.M1Y) To: sin( self.Rotation )-22 [or*16]

    Then the emitter has two constrain attributes that read:
    (self.Position.X) To: game.M1X
    (self.Position.Y) To: game.M1Y

    See anything here that I am tripping myself with? I really appreciate the help You've given and the help in advance. I'm going to go read up on cos/sin... >.<

    Thanks again!
  • PhoticsPhotics Member Posts: 4,172
    Are the X and Y above game attributes? And if so are they integer, real or?
    And is the *16 part of the Trigo math or a measurement in your game?
    The X & Y is the "Emitter Offset" in the "Particles" behavior. It's the second tab. It doesn't use X or Y. It uses icons. The number 16 is basically the radius of the circle. This number can change depending on the effect/actor/game.
  • FiredangerFiredanger Member Posts: 3
    Photics, You rock!

    Following your tips I was able to make the particle emitters stay at either side of the tank, I was not able to manipulate the Y axis for some reason, increasing or decreasing the number after the asterisk only seemed to push or pull the point in or out slightly more on the X axis. But not to worry, it looks great. I was able to make a box below the tank that holds the emitters so it looks like the dirt is coming out from below.
    I greatly appreciate your pointers. Thanks again!

    ps. I looked up up cos/sin... After about 15 min I had to take a break, so I went outside and hit myself with a 2x4, in the head. It made the pain go away! : )
  • IcedBIcedB Member, PRO Posts: 384
    What if I have a lot of randomly spawning actors and I want to create a mask over the actor that when hit by a bullet kills the actor. Either I need a ton of attributes (via the above method). Or i suppose I could have it so that my bullets have constrained updating x/y co-ordinates attached to attributes(with a limit of bullets allowed at any one time, and when these match the co-ordinates of the actor within a given distance it kills the actor. I ask this because often the surrounding area around should not trigger the destruction of the actor when it collides with a bullet.....
Sign In or Register to comment.