Skip to content

Commit fbbc503

Browse files
committed
added getPitch / getYaw
1 parent 0ed311e commit fbbc503

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main/java/dev/zwazel/internal/game/transform/Quaternion.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,12 @@ public Vec3 down() {
8888
public Vec3 left() {
8989
return this.apply(Vec3.X.multiply(-1));
9090
}
91+
92+
public double getPitch() {
93+
return Math.atan2(2 * (w * x + y * z), 1 - 2 * (x * x + y * y));
94+
}
95+
96+
public double getYaw() {
97+
return Math.atan2(2 * (w * z + x * y), 1 - 2 * (y * y + z * z));
98+
}
9199
}

0 commit comments

Comments
 (0)