how do i stop the stuttering?

i’m trying to get an object to move a certain way. it’s a spaceship i have it moving how i want it but it stutters as it moves. i want to have it point the direction that is pressed on the joystick and then the thrust button to move it forward. after the thrust is released i want it to float forward for a small distance in that direction but still be able to turn towards a different direction.
any suggestions to get rid of the stuttering?

this is the code i have on my player object:


public float rotationSpeed = 450;
public float accelerationForce = 10f;
private Quaternion targetRotation;

void Start () 


void Update () 

	float acceleration = Input.GetAxis ("Thrust");
	rigidbody.AddForce (transform.forward * acceleration * accelerationForce);
	Vector3 input = new Vector3(Input.GetAxisRaw("Horizontal"),0,Input.GetAxisRaw("Vertical"));
	if (input != {
		targetRotation = Quaternion.LookRotation (input);
		transform.eulerAngles = Vector3.up * Mathf.MoveTowardsAngle(transform.eulerAngles.y, targetRotation.eulerAngles.y, rotationSpeed *Time.deltaTime);


Generally speaking, you should either choose to modify an object kinematically (i.e. you directly set transform.position and transform.rotation in the Update() loop), or you apply forces and let the physics engine resolve the corresponding position and rotation (i.e. use rigidbody.AddForce() in FixedUpdate()).

You’re doing a mixture of both, which can have interesting side effects. At the very least, you should move your AddForce() code into FixedUpdate() rather than Update(), and see if that makes a difference.

If you press a key, transform.position = vector3.forward… if you let go of that key, let the velocity be a slerp between your current velocity and 0.

Let me know if you need this in code form!