# Problem matching particle & object velocities + speed

I have a scene with a ship that currently has an ellipsoid emitter attached to fire particles (as projectiles) directly forward using the emitter's Local Velocity value. This works fine and the emitter rotates along with the ship when it is stationary, however once the ship is moving the particles either lag behind, travel too fast ahead of the ship, or a combination of the two (varying with each particle, I think that may just be a glitch).

I tried setting the Emitter Velocity Scale to 1, hoping they would begin with the ship's velocity and then add their own Local Velocity value to that in order to maintain the same speed as when stationary, however this creates the unwanted acceleration. Am I right in thinking this is because I'm using AddForce to accelerate my ship rather than changing its velocity directly? Note that this happens even when no force is being added and the ship is simply continuing forward at its current velocity. If AddForce is the cause, is there any way to continue to use it and still keep the particle velocity in line with the ship velocity?

Thanks.

Oh, of course as soon as I commented I realized how to do it. I made a script that sets the world velocity of the emitter (ie the gun) to the same as the target (ie the ship). Add the script below to the same gameobject as your emitter, and drag the 'ship' into it as the target. In this case it's a rigidbody because it's easy to get the velocity.

``````public class InheritParentVelocity: MonoBehaviour {

public Rigidbody target;
private ParticleEmitter theEmitter;
public bool inheritParentVelocity=true;

void Start()
{
theEmitter=transform.GetComponent<ParticleEmitter>();
}

void Update ()
{
if(inheritParentVelocity)
theEmitter.worldVelocity = target.velocity;
else
theEmitter.worldVelocity = Vector3.zero;
}

}

``````

I'm not sure if this is the effect you want, because I had a hard time understanding your explanation, but try (un)checking the Simulate in worldspace? checkbox. This means your particles will basically either exist in global or local space, and it sounds like you want the latter.