Quaternion.LookRotation and Vector3.SmoothDamp Problems

Hello,

I have a problem with my rotation script.
I am using Vector3.SmoothDamp to rotate my space ship smoothly to face a target that I get through Quaternion.LookRotation.

But it’s turning to the right most of the time, even when the target is on the left.
Sometimes it works and the ship is turning to the left.

Currently I’m only using this on the y-axis, when I try to do this in 3D-space, everything bugs around.


Following is called in FixedUpdate:

targetRotation = Quaternion.LookRotation(moveTarget - this.transform.position).eulerAngles;
this.transform.rotation = Quaternion.Euler (Vector3.SmoothDamp(this.transform.rotation.eulerAngles, targetRotation, ref rotationVelocity, type.rotationAcceleration, type.maxRotationSpeed));

Thank you very much, but my system fits my needs now :slight_smile:

Btw. here my code in case someone needs something like this:

targetRotation = Quaternion.LookRotation(moveTarget - this.transform.position).eulerAngles;
			
			Vector3 eulerAngles = this.transform.rotation.eulerAngles;
			
			eulerAngles.x = Mathf.SmoothDampAngle(eulerAngles.x, targetRotation.x, ref rotationVelocity.x, type.rotationAcceleration, type.maxRotationSpeed);
			eulerAngles.y = Mathf.SmoothDampAngle(eulerAngles.y, targetRotation.y, ref rotationVelocity.y, type.rotationAcceleration, type.maxRotationSpeed);
			eulerAngles.z = Mathf.SmoothDampAngle(eulerAngles.z, targetRotation.z, ref rotationVelocity.z, type.rotationAcceleration, type.maxRotationSpeed);
			
			this.transform.rotation = Quaternion.Euler (eulerAngles);