I am trying to get real-world human body height from ARBodyAnchor. I understand that I can get real-world distance between body joints. For example hip to foot-joint as in code below. But how do I get distance from top of head to bottom of foot?
func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
if anchor is ARBodyAnchor {
let footIndex = ARSkeletonDefinition.defaultBody3D.index(for: .leftFoot)
let footTransform = ARSkeletonDefinition.defaultBody3D.neutralBodySkeleton3D!.jointModelTransforms[footIndex]
let distanceFromHipOnY = abs(footTransform.columns.3.y)
print(distanceFromHipOnY)
}
}
Read this post if you need to setup a custom model for MoCap.
The default height of
ARSkeleton3Dfromright_toes_joint(or if you wishleft_toes_joint) to head_joint is 1.71 meters. And sincehead_jointin Apple's skeletal system's definition is the upmost skeleton's point, you can use the common skull's height – from eye line to crown.In other words, the distance from
neck_3_jointtohead_jointin virtual model's skeleton is approximately the same as fromhead_jointtocrown.There are 91 joint in
ARSkeleton3D:Code:
However, we have a compensator:
The default value of
estimatedScaleFactoris 1.0.If you set:
ARKit sets this property to a value between 0.0 and 1.0.