Yaw problem

So my character(a.k.a. ship representation) does not Yaw all the way on both sides. If I increase or decrease the YawFactor it only helps one side/direction and conversely worsens the opposite side/direction. I thought this was just an issue with my “ship” but after watching other peoples clips here of their ships, I see the same issue. No forward facing ships all the way to the left or right of the game screen. They all still have a centered positional direction to some degree. Is there a way to fix this or code it differently so when you are at max left or max right position with your “ship” it stays facing forward? Similar to the pitch, having to have a max top end and max bottom end in the range. I couldn’t figure this out based on it using the Quaternion equation vs Mathf.Clamp…

Hi,

Check the local position of your character. If the ship is in the centre of the game window, his local position must be (x: 0, y: 0). Our pitch/yaw/roll algorithm refers to these coordinates.

My “ship” is at 0,0,0 for all translations and rotation settings, and a scale of 1,1,1. I even tried putting it into an empty game object and the same settings and still does not work.

I also copied the code from the courseware and pasted into my file so nothing was coded wrong.

Have you already tried to add Debug.Logs to your code to see what is going on during runtime? Log the position and rotation values into your console to see if you get the expected results and when the values start becoming weird.

The issue with rotations is that Unity internally works with Quaternions. The conversion from Euler angles to Quaternions could result in unexpected values because, unlike Quaterions, Euler angles are ambiguous. That’s an unsolveable mathematical problem.

One thing to avoid any misunderstandings: Without pitch/yaw/roll, our ship always faces forwards. The rotation is just an optical illusion caused by the camera “lens”. With pitch/yaw/roll, we do rotate the ship, and it stops facing forwards. If the rotation is your problem, try to comment pitch/yaw/roll out to see if your game works better without them.

Privacy & Terms