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

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.
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
-
Photics Posts: 4,172
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
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!
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! : )