Add Transform and client yaw helpers to Quaternion
Transform holds location, rotation and scale as the client's ArcObjectInfo does, with parent x local composition (sb.exe 0x6516C0). Quaternion.fromYaw matches the client's MakeRotateY and getYaw returns the angle it would need. Nothing uses them yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
74b2eaaaf2
commit
2078a5c344
2 files changed
+56
No files matched your search
@@ -1142,6 +1142,17 @@ public class Quaternion {
|
||||
return opposite(this);
|
||||
}
|
||||
|
||||
// Client MakeRotateY (Math.dll 0x10002960): w = cos θ/2, y = sin θ/2, radians.
|
||||
// Math rather than FastMath: FastMath.reduceSinAngle mis-reduces angles below -π.
|
||||
public static Quaternion fromYaw(float yaw) {
|
||||
return new Quaternion(0f, (float) Math.sin(yaw * 0.5), 0f, (float) Math.cos(yaw * 0.5));
|
||||
}
|
||||
|
||||
// The angle MakeRotateY would need to produce this rotation; characters send it as one float.
|
||||
public float getYaw() {
|
||||
return 2 * FastMath.atan2(y, w);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Quaternion clone() {
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user