- Home /
Rotating emitter direction whilst maintaining particle velocity
I have a ship that rotates and moves along its z axis with an ellipsoid emitter attached as a child. The emitter rotates as the ship does, and spews out particles along its Local Axis z value, when the ship is stationary, however when the ship is in motion the particles follow the ship's velocity vector (ie local z) rather than its current rotation about the y axis. This leads to the ship facing in one direction and its particle stream following its movement along another instead. I find this odd, since the emitter's z axis must be rotating about y to match that of the ship when the ship is still.
So, why is it doing this, and how can I make my emitter's local z axis (or whatever it uses for the Local Velocity z axis value) match that of the ship's at all times?
Thanks.
Answer by Murcho · Jun 02, 2010 at 01:05 AM
The best way is to make the particle emitter a child of the ship, so then it will follow constantly and alway be in the correct position. You should also set the emitter to simulate in world space so that when the space ship turns the particles far from the ship don't turn with the ship.
There is a section in the 3D Platforming Tutorial on how to set this kind of system properly if you're interested in more details. It's in the first half of the tutorial, so shouldn't be difficult to find, just look for the section on setting up Lerpz's jetpack.
Yes, I've already done both those things and it isn't working. It's obviously following the z axis of the ship since adding transform.rotation.z=transform.parent.rotation.z has no effect and the particles follow the correct line when the ship rotates and is still, but the movement seems to somehow break it (also breaks with the above code attached).
Addendum: I see what the problem is now, it's related to the other problem I'm having: http://answers.unity3d.com/questions/11433/problem-matching-particle-object-velocities-speed
The particles are, in fact, facing in the correct direction but they're still inheriting the forward velocity of the ship as they emit. I'll mark this as solved, despite it depending on a fix for the other problem.