Hi all, I’m quite new to XR development in general and need some guidance.
I want to create a function that simply tells me if my palm is facing me or not (returning a bool), but I honestly have no idea where to start. I saw an earlier Reddit post about 6 months that essentially wanted the same thing I need, but the only response was this:
Consider a triangle made up of the wrist, thumb knuckle, and little finger metacarpal (see here for the joints, and note that naming has changed slightly since this WWDC video): the orientation of this triangle (i.e., whether the front or back is visible) seen from the device location should be a very exact indication of whether the user’s palm is showing or not.
While I really like this solution, I genuinely have no idea how to code it, and no further code was provided. I’m not asking for the entire implementation, but rather just enough to get me on the right track.
Heres basically all I have so far (no idea if this is correct or not):
func isPalmFacingDevice(hand: HandSkeleton, devicePosition: SIMD3<Float>) -> Bool {
// Get the wrist, thumb knuckle and little finger metacarpal positions as 3D vectors
let wristPos = SIMD3<Float>(hand.joint(.wrist).anchorFromJointTransform.columns.3.x,
hand.joint(.wrist).anchorFromJointTransform.columns.3.y,
hand.joint(.wrist).anchorFromJointTransform.columns.3.z)
let thumbKnucklePos = SIMD3<Float>(hand.joint(.thumbKnuckle).anchorFromJointTransform.columns.3.x,
hand.joint(.thumbKnuckle).anchorFromJointTransform.columns.3.y,
hand.joint(.thumbKnuckle).anchorFromJointTransform.columns.3.z)
let littleFingerPos = SIMD3<Float>(hand.joint(.littleFingerMetacarpal).anchorFromJointTransform.columns.3.x,
hand.joint(.littleFingerMetacarpal).anchorFromJointTransform.columns.3.y,
hand.joint(.littleFingerMetacarpal).anchorFromJointTransform.columns.3.z)
}