Util [Rotating Armorstand] Converting degrees/radians to EularAngles

Discussion in 'Resources' started by Zombie_Striker, Mar 9, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    Zombie_Striker

    Introduction:
    EulerAngles are objects that Armorstands use to orientate limbs. This util is here to help developers convert degrees or radians to EulerAngles.

    code:
    Code:
        public static EulerAngle angleToEulerAngle(int degrees){
            return angleToEulerAngle(Math.toRadians(degrees));
        }
        public static EulerAngle angleToEulerAngle(double radians){
            double x = Math.cos(radians);
            double z = Math.sin(radians);
            return new EulerAngle(x,0,z);
        }    
    Disclaimer. This is only designed for rotations (such as for arms and heads). Because of that, I did not account for yaw. I may come back and add that as a feature later, but for now, you will have to manually set the Y if you need a change in pitch.
     
    Last edited: Mar 9, 2017
    FisheyLP likes this.
  2. Math.toRadians(degrees) ;)
     
    ChipDev and Zombie_Striker like this.
Thread Status:
Not open for further replies.

Share This Page