I'm working on capturing 3D motion using ARKit3 in which I get transforms of all the Joints by using jointsModelTransforms
or jointsLocalTransforms
in session:didUpdate:
delegate method of ARSessionDelegate
like below
func session(_ session: ARSession, didUpdate anchors: [ARAnchor]) {
for anchor in anchors {
guard let bodyAnchor = anchor as? ARBodyAnchor else { continue }
let bodyTransforms: [simd_float4x4] = bodyAnchor.skeleton.jointModelTransforms
// TODO
}
}
First index of bodyTransforms
array is the root
joint.
Would like to know the order of joints in which the array is represented?
Here is a documentation about the ARSkeletonDefinition
, the class containing the hierarchy of joints and their names.
In your case, names and order of the joints can be easily obtained via calling bodyAnchor.skeleton.definition.jointNames
.