Hi all,
I want to rotate my character smoothly from GetAxis input. At the moment the rotation axis seems to only have about 16 points of rotation, so there is small snapping between these points as my character adjusts his trajectory in movement.
Here is my code at the moment:
// Get players input axis'
xSpeed = Input.GetAxis("Horizontal");
zSpeed = Input.GetAxis("Vertical");
// Get the player direction vector
Vector3 velocityAxis = new Vector3(xSpeed, 0, zSpeed);
// Rotate the movement vector based on the camera - makes player movement relative to the camera view.
velocityAxis = Quaternion.AngleAxis (Camera.main.transform.eulerAngles.y, Vector3.up) * velocityAxis;
// Rotate the player's model to show direction
if (velocityAxis.magnitude > 0)
{
transform.rotation = Quaternion.LookRotation (velocityAxis);
}
Can anyone help?
Big thanks!