Is This a Bug With "Quaternion Create Look"or Am I Going bout This The Wrong

Here is the process the system goes through-

  1. Get’s A’s postion, A being an object above me, and it does the same for B, B being the local player.
    ~ This is a single player subroom.

  2. Get’s a direction that points from A to B by subtracting A’s position from B’s position and then normalizing the difference.

  3. Splits the direction into two vector, being the direction’s X and Z, as the first vector, to get “Forward” and the direction’s Y, as the second Vector, to get “Upwards”.

  4. Uses the “Forward” and “Upwards” to create a quaternion through “Quaternion Create Look”.

  5. Puts the quaternion into “Quaternion Euler Angles” to get the pitch, yaw, and roll in degrees by creating a vector.

  6. Splits the vector to get only the yaw, as yaw is the only one I need.

The system is shown below.



I apoligize for how poor the screenshots came out.

If you look at the pictures, you may see that I am hovering over the outputs for “Quaternion Create Look” and "Quaternion Euler Angles. Directions use pitch yaw pitch and euler angles use pitch yaw roll. You don’t really need to know this but it helps to understand the next part.
When the quaternion is turned into a euler angle, the only rotation that is correct is the yaw. The pitch rotation is always 0º and the roll rotation is always 180º. If I switch the “Foward” and "Upward ports, the pitch changes to 90º and the roll to 0º.

Thankfully, I only need the yaw roation, but I would still like to know what is or may be going on.

1 Like

The reason for this happening is because you’re defining the entire rotation from a single Vector3 which can only store Yaw and Pitch.

To somewhat fix this, instead of splitting your original directional vector into X,Z and Y, use that as the forward vector and create a new vector with “Vector3 Create” and set the Y value to 1.

What this will do is allow you to extract the Yaw and Pitch (if needed) and allow the roll to be represented correctly based on the Up directions orientation. It will always show 0 in the “roll” angle because your up direction is always 0,1,0. But this will allow for the Yaw and Pitch to be represented correctly.

Since your only pointing a direction towards yourself, you cannot really extract a roll rotation from this direction. Which is why I’m suggesting to just create that placehold “Up” direction.

Hope this helps clear up that confusion!

1 Like

Then why does it give a roll that is more then zero?

1 Like

What is the value it giving as it’s output for roll? Also make sure you’re checking the correct output, there should be two angles giving Yaw and Pitch, and one that doesn’t change (roll).

1 Like

Nevermind, I forgot pitch is both x and z for a moment.
My bad

Sure! However I’m a little confused by:

Pitch is both x and z

Pitch and yaw should be represented separately as their own angles(x, z), it’s unusual for it to be a combination of both.

Is this what you meant?

I said that in the wrong order. My bad, again.

1 Like