So, I was programming a very simple mouse look script. The vertical rotation works fine (I only rotate the camera there), but if I try to rotate my player in horizontal direction, I get this error message:
**Assertion failed on expression: 'IsNormalized (ray.GetDirection ())'**
The mouse look itself works fine, but I get 60 of those error messages per second, which certainly isn't a good thing.
This is my code:
CharacterController playerMotor;
Camera cam;
void Start () {
playerMotor = GameObject.Find("Player").GetComponent();
cam = Camera.main;
}
void MouseLook ()
{
//this function is called in FixedUpdate ()
Vector3 horizontalRotation;
Vector3 verticalRotation;
horizontalRotation = new Vector3(0, Input.GetAxis("Mouse X"), 0);
verticalRotation = new Vector3(Input.GetAxis("Mouse Y"), 0, 0);
playerMotor.transform.Rotate(horizontalRotation);
cam.transform.Rotate(-verticalRotation);
}
I had more or less the same script in an older version of Unity. Since the last update I get that error message though. Does anyone know why this could happen?
I'm using Unity 5.5.0f3 btw.
↧