Choppy movement when rotating

I have an object that’s flying. I am using mouse input to move it around the screen, and i use rigidbody.AddForce() to do so. This works absolutely fine.

However, there is a problem. To rotate it towards where i click, i do the following:

When i click:

_targetLocation = targetLocation;
_originRotation = transform.rotation;
_remainingTurn = 0.0f;
_moving = true; 

And then each update:

if( _remainingTurn < 1.0f )
{
_remainingTurn += Time.deltaTime * turnRate;
_targetRotation = Quaternion.LookRotation(_targetLocation - transform.position, Vector3.up);
transform.rotation = Quaternion.Slerp(_originRotation, _targetRotation, _remainingTurn );
}
if( _moving && rigidbody.velocity.magnitude < Mathf.Min(maxSpeed, distanceToTarget * 2) && distanceToTarget > movementThresholdDistance )
{
rigidbody.AddForce( (_targetLocation - transform.position) / distanceToTarget * acceleration * Time.deltaTime);
}

This makes my object rotate towards where i clicked quite nicely, but for some reason the entire object moves very choppily as long as it’s rotating. I tried changing the rotation line to just set the rotation to the target rotation, but even then, without the Slerp, it moves very choppily as long as _remainingTurn is lower than 1.

Any idea what causes this?

I fixed the problem. It’s solved by moving everything to FixedUpdate.

I think this might be because you are combining physics and setting the transform directly.

Maybe you should try using Rigidbody.AddTorque to rotate your object via physics instead of setting transform.rotation.