Help with Quaternions and Vector3s

Quaternion newRotation = Quaternion.LookRotation(playerToMouse);
playerRigidbody.MovePosition (newRotation);

With this code, I’m getting the error "Argument 1: cannot convert from ‘UnityEngine.Quaternion’ to ‘UnityEngine.Vector3’ ". I am following the Survival Shooter Tutorial, but am getting an error from the code they wrote. Maybe an issue with the newer version of Unity?


this method expects a Vector3 but your newRotation is a rotation. Either you should stop the tutorial right now as it is a pile of junk or you did not follow exactly (maybe a bit of both).

The first line gets a rotation while the second line performs a movement. You must have something missing in between. Event converting your rotation to a vector3 would not make sense as you get a rotation and MovePosition should get a position to move to.

From what I see in the tutorial code:

// Create a quaternion (rotation) based on looking down the vector from the player to the mouse.
Quaternion newRotation = Quaternion.LookRotation (playerToMouse);

// Set the player's rotation to this new rotation.
playerRigidbody.MoveRotation (newRotation);

So it’s NOT playerRigidbody.MovePosition but playerRigidbody.MoveRotation