summaryrefslogtreecommitdiff
path: root/include/d/d_pad.h
diff options
context:
space:
mode:
authorrobojumper <robojumper@gmail.com>2025-07-25 23:04:33 +0200
committerrobojumper <robojumper@gmail.com>2025-07-25 23:04:33 +0200
commit36898b4883a76f595737ef768f375541947f4607 (patch)
tree20dc42207713367b70a7de866162dfcdc5d9c497 /include/d/d_pad.h
parent27f670cf2af52034886d089fc49b2952121b1584 (diff)
Small cleanup
Diffstat (limited to 'include/d/d_pad.h')
-rw-r--r--include/d/d_pad.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/d/d_pad.h b/include/d/d_pad.h
index 0d4f4129..fbfca801 100644
--- a/include/d/d_pad.h
+++ b/include/d/d_pad.h
@@ -53,12 +53,29 @@ class ex_c {
/* 0x10D8 */ s32 field_0x10D8;
};
+ // Orthonormal Basis vectors of the Mpls attachment in 3D space.
+ // Z+ is forward, Y+ is up, and X+ is left. So a Wiimote pointing at
+ // the Screen will have vectors (1, 0, 0), (0, 1, 0), (0, 0, 1).
+ // Of particular interest here is mZ, which tells you in which direction
+ // the Wiimote points.
struct mpls_c {
mpls_c() : mX(mVec3_c::Ex), mY(mVec3_c::Ey), mZ(mVec3_c::Ez) {}
mMtx_c getMtx() const;
/* 0x00 */ mVec3_c mX;
/* 0x0C */ mVec3_c mY;
/* 0x18 */ mVec3_c mZ;
+
+ // vertical angle. 0 is forward, positive is pointing upwards,
+ // negative is pointing downwards
+ mAng getVerticalAngle() const {
+ return cM::atan2s(mZ.y, mZ.absXZ());
+ }
+
+ // horizontal angle. 0 is forward, positive is pointing to the left,
+ // negative is pointing to the right
+ mAng getHorizontalAngle() const {
+ return cM::atan2s(mZ.x, mZ.z);
+ }
};
public: