How does this snippet of code create a ray direction vector?
Posted
by
Isaac Waller
on Game Development
See other posts from Game Development
or by Isaac Waller
Published on 2011-11-25T23:04:53Z
Indexed on
2011/11/26
2:09 UTC
Read the original article
Hit count: 294
In the Minecraft source code, this code is used to create a direction vector for a ray from pitch and yaw:'
float f1 = MathHelper.cos(-rotationYaw * 0.01745329F - 3.141593F);
float f3 = MathHelper.sin(-rotationYaw * 0.01745329F - 3.141593F);
float f5 = -MathHelper.cos(-rotationPitch * 0.01745329F);
float f7 = MathHelper.sin(-rotationPitch * 0.01745329F);
return Vec3D.createVector(f3 * f5, f7, f1 * f5);
I was wondering how it worked, and what is the constant 0.01745329F
?
© Game Development or respective owner