public
Created

pitch/yaw to directional vector

  • Download Gist
gistfile1.java
Java
1 2 3 4
// pitch and yaw are in degrees
Vector3D getDirectionVector() {
return new Vector3D(-Math.cos(pitch * Math.PI / 180.0) * Math.sin(yaw * Math.PI / 180.0), Math.sin(pitch * Math.PI / 180.0), -Math.cos(pitch * Math.PI / 180.0) * Math.cos(yaw * Math.PI / 180.0));
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.