How does YAW work?


#1

I just testing 1009, and spotted YAW in the stats window. :open_mouth:
But the strange thing, its going roatte from 0 to 180 and when your at 180 and rotate further its going down from 180 - 0 . no negative number., only positive.


#2

how does yaw what work?


#3

A yaw rotation is a movement around the yaw axis of a rigid body that changes the direction it is pointing, to the left or right of its direction of motion. Hence, facing forward on the x axis is 0 (degrees), and you can yaw in either direction up to 180 degrees, once you pass the -x point, it is going to read the other direction’s yaw, and since you’re rotating back towards forward x, the number will go from 180 down to 0.

So, you can yaw left or right (from facing foward on the x axis) up to 180 degrees.

The largest angle you can face away from +X is 180 degrees…

Y is the Yaw axis in HF.


#5

Ok, but then i see one strange thing. the yaw is 0-180-0 it would make sense if its going from 0 to 180 and from -180 to 0. the yaw hifi is showing dont tell you really wich direction you turn. i cannot say if am turning left or right. missing indicator on the screen ?

Or its just working wrong in mouse mode.


#6

Yaw isn’t about direction, it’s about how much rotation from “forward” you are. Technically, the yaw angle is the number of degrees you are rotated left or right from you forward motion. In this case, it’s how many degrees you’re rotated (on the Y axis), from the direction of the +X axis. In other words, think of it as facing +X is facing north, and yaw is own many degrees away from north you’re rotated.

Yaw isn’t used to calculate rotation. Roll, Pitch and Yaw are Euler co-ordinates, and you can run into something called gimbal lock, so rotations are calculated using quaternions, not Euler co-ordinates.

You’re thinking in terms of rotation, but Yaw is used with rate of change of a heading, calculating angular velocities and such. There are no negative velocities.


#7

Ok. understand.

yiks, quaternions. the still give me headace.
i preffer to program in degree’s then you know what happens.
quaternions i still have not figured out, it gives me headace.


#8

Yeah, well, luckily you can still work in Euler which is alot easier to wrap you head around. We have a bunch of helper functions to help us do conversion …

quat Quat.fromVec3Degrees(const glm::vec3& vec3); Will convert Euler co-ordinates in degrees to quaterion which you can feed to the rotation functions to rotate stuff.

Quaternion functions:

quat Quat.multiply(const glm::quat& q1, const glm::quat& q2);
quat Quat.fromVec3Degrees(const glm::vec3& vec3);
quat Quat.fromVec3Radians(const glm::vec3& vec3);
quat Quat.fromPitchYawRollDegrees(float pitch, float yaw, float roll);
quat Quat.fromPitchYawRollRadians(float pitch, float yaw, float roll)
quat inverse(const glm::quat& q);
vec3 getFront(const glm::quat& orientation);
vec3 getRight(const glm::quat& orientation);
vec3 getUp(const glm::quat& orientation);
vec3 safeEulerAngles(const glm::quat& orientation);
quat angleAxis(float angleInDegrees, const glm::vec3& v);
quat mix( quat q1, quat q2, float alpha);
void print(string lable, quat q);

Vector3 functions:

vec3 cross(vec3 v1, vec3 v2);
float dot(Vec3 v1, vec3 v2);
vec3 multiply(const glm::vec3& v1, float f);
vec3 multiplyQbyV(const glm::quat& q, const glm::vec3& v);
vec3 sum(const glm::vec3& v1, const glm::vec3& v2);
vec3 subtract(const glm::vec3& v1, const glm::vec3& v2);
float length(const glm::vec3& v);
float distance(Vec3 v1, Vec3 v2);
Vec3 normalize( Vec3 v);
void print( string lable, Vec3 v);