RB Interpolation

I’m a little confused, because right now my character is shooting a projectile with a non-kinematic RB, it’s movement is shown below:

 private void FixedUpdate()
    {
       rb.velocity = shootDirection * speed * Time.deltaTime;
    }

yet for some reason I’m still seeing a pretty bad jitter on the projectile. The only way I’ve found to fix this is to set the RB Interpolation on the projectile Gameobject to “Interpolate” - but per the Unity documentation this is really only recommended for a character gameobject.

I feel as though I’ve done something wrong if I have to set it’s Interpolation to “Interpolate”.
Does using Interpolate cost much performance-wise?
FYI - my cameraFollow is being updated in the LaterUpdate() function.

Let me know if there’s any more info you need. I’m just confused because I’ve never had to play around with the interpolation before to get smooth results.

I think the problem might be that you set velocity every fixed update (at least in provided code) and you multiply it with Time.deltaTime which is a different number every time. It is impossible to interpolate trajectory in such implementation. Instead, you probably want to set velocity just once and do not multiply it with Time.deltaTime (so you will need to decrease the “speed” value probably). Now you you may or may not need to use interpolation, try both and see what looks better.

You can set velocity in Start() method in the script attached to the projectile or anywhere else, you don’t need to set velocity in FixedUpdate(). Note that now, when you set velocity only once, your rigidbody drag will slow the projectile down, so make sure it is zero or small enough.

I think the problem might be that you set velocity every fixed update (at least in provided code) and you multiply it with Time.deltaTime which is a different number every time. It is impossible to interpolate trajectory in such implementation. Instead, you probably want to set velocity just once and do not multiply it with Time.deltaTime (so you will need to decrease the “speed” value probably). Now you you may or may not need to use interpolation, try both and see what looks better.

You can set velocity in Start() method in the script attached to the projectile or anywhere else, you don’t need to set velocity in FixedUpdate(). Note that now, when you set velocity only once, your rigidbody drag will slow the projectile down, so make sure it is zero or small enough.

This is excellent info, thanks so much! I had no idea you could set it only once. This should definitely be better performance-wise.

See g_raver for official answer. The option to convert his answer as the official answer isn’t working right now for some reason