getYaw() returns the looking direction in degree. 360° is one full rotation. When you continue rotating the returned number just increases. 720° direction for example is equal to the 0° direction. When you rotate counterclockwise the number decreases and can get negative.
getYaw() returns the looking direction in degree. 360° is one full rotation. When you continue rotating the returned number just increases. 720° direction for example is equal to the 0° direction. When you rotate counterclockwise the number decreases and can get negative.
0° +Z west
90° -X north
180° -Z east
270° +X south
Oh, OK. Is there a way to make it "wrap around" to stay between 0 and 360?
Rollback Post to RevisionRollBack
Seeing this reference here... It fills you with determination!
"Knowlage is Power!"- School House Rock "Codeing is the best power in the world!"- Me
Have fun and code on!
Rocket Science: -Mg=(M-R*t)a+R*t(Ve-g)
Hello, I have a question.
I am trying to figure this out, but I can't seem to correctly get what direction the player is looking.
I know I need to use the "getYaw()" code, but it always returns one number that is huge, like "-731.812".
I need to split it into separate X and Z variables (block directions) for a code.
Can someone help me with this?
Seeing this reference here... It fills you with determination!
"Knowlage is Power!"- School House Rock
"Codeing is the best power in the world!"- Me
Have fun and code on!
Rocket Science: -Mg=(M-R*t)a+R*t(Ve-g)
getYaw() returns the looking direction in degree. 360° is one full rotation. When you continue rotating the returned number just increases. 720° direction for example is equal to the 0° direction. When you rotate counterclockwise the number decreases and can get negative.
0° +Z west
90° -X north
180° -Z east
270° +X south
Oh, OK. Is there a way to make it "wrap around" to stay between 0 and 360?
Seeing this reference here... It fills you with determination!
"Knowlage is Power!"- School House Rock
"Codeing is the best power in the world!"- Me
Have fun and code on!
Rocket Science: -Mg=(M-R*t)a+R*t(Ve-g)
var orientation = getYaw() % 360; if (orientation < 0) { orientation += 360; }or in one line
Thanks so much!
Seeing this reference here... It fills you with determination!
"Knowlage is Power!"- School House Rock
"Codeing is the best power in the world!"- Me
Have fun and code on!
Rocket Science: -Mg=(M-R*t)a+R*t(Ve-g)
I Suggest:
Adding Math.round();
It Will Just Remove The Extra Decimals!
But Will Make It Inaccurate!