Advertisement
iMackshun

Generates a Unit Vector, given degrees.

Jun 9th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. public void SetForwardDirectionToRotation() {
  2.         ForwardDirection.x = (float) Math.cos(YRotation * MathUtils.degreesToRadians);
  3.         ForwardDirection.z = (float) Math.sin(YRotation * MathUtils.degreesToRadians);
  4.         // System.out.println("YRotation: " + YRotation);
  5.         // System.out.println("ForwardDirectionX: " + ForwardDirection.x +
  6.         // " ForwardDirectionZ: " + ForwardDirection.z);
  7.     }
  8.  
  9.     public void SetUpDirectionToRotation() {
  10.         //Rotate the Up Direction on the X.
  11.         UpDirection.y = (float) Math.sin(XRotation * MathUtils.degreesToRadians);
  12.         UpDirection.z = (float) Math.cos(XRotation * MathUtils.degreesToRadians);
  13.         // System.out.println("XRotation: " + XRotation);
  14.         // System.out.println("UpDirectionZ: " + UpDirection.z +
  15.         // " UpDirectionY: " + UpDirection.y);
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement