Low frame rate when using quaternions.

When I try using a quaternion to control the rotation of my character, the code works but it runs at about 2 fps. When I comment out the following function in my code, the game runs at 60+ FPS. Also when the character is moving around, the framerate increases back to normal, and when I stop moving, it will drop back down to about 2 fps. It takes about 2 seconds of moving for the framerate to go back up to 60+ fps.

The code that appears to be causing the problem is:

	void Turning ()
	{
		Quaternion newRotation = Quaternion.LookRotation (movement);
		playerRigidbody.MoveRotation (newRotation);
    }

movement is a Vector3 variable declared at the top of the code. Turning is called in FixedUpdate.

My pc is running a GeForce GTX 970 and an AMD FX-6300 at 4GHz with 8GB of RAM.

Look if there’s any error messages in the log. The LookRotation function logs an error when the vector given as parameter is zero. The fps drops if the error is logged every FixedUpdate when your character is stationary and the movement vector you’re giving is zero.

You can also always try the profiler to see what part of your code takes long to execute and cause fps drops.