Builtin Library
README.md
xr_body
The body that follows the person in a headset, in the way of a social VR avatar: three-point IK from the head and the two hands.
The eyes are the real head, and the body follows it:
- Lean, look and crouch move the upper body. The head bone reaches the real
head: the hips drop for a crouch and shift toward a lean, the spine bends the rest
of the way, and the neck and head turn toward the way the head faces (the body's
IKRig,headTargetandlookTarget). - The torso turns toward the way the head faces once the head is past a slack of 40 degrees, at 160 degrees per second, while the body is not walking.
- Real steps in the room carry the body once the head stands 0.3 m from it,
through the character controller's own wall pass, so a wall stops the body. What
the body was carried by is taken out of the eyes' offset (
body.absorbed), so the eyes stay where the real head is. - The legs step when the body moves or turns. A foot stays where it was
planted until its home, beside the body, is 0.2 m away; then it steps (0.24 s, 8 cm
high), one foot at a time, and plants. The
IKRigfoot targets carry the feet. - Trackers place the hips and the feet: a device located under the role
waistplaces the hips, andleft_footandright_footplace the feet in place of the stepping.
The pure rules are followStep, yawStep, stepFeet, footHomes, headBoneTarget
and eyesFromHead. new(bodyEntity) makes a body and tick(body, frame, rig) runs
one frame against it; drop(body, rig) takes the targets down. The presentation of
xr_embodiment runs it.