Question by
SQUARE-BADGER · Oct 20, 2017 at 05:47 PM ·
c#unity 5rotationscripting problemnewbie
how do I rezolve "look rotation viewing vector is zero"?
Hi!, I have a little problem,I wanted to make a code that makes my player to look at the direction of the 360 joystick but when my stick reaches the deadzone I get Look rotation viewing vector is zero, and my character instantly gets rotation 0. I want my character to stay in its position, not reset to 0 :(
I used this code
transform.forward = Vector3.Normalize(new Vector3(Input.GetAxis("Horizontal"), 0f, Input.GetAxis("Vertical")));
Comment
Answer by MaxGuernseyIII · Oct 20, 2017 at 06:52 PM
If it were me, I would use those axis values as values in spherical coordinates.
If you don't want to do that, you can probably just change the 0f to be a different value, like 1f, and your vector will never be zero-length.