-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88798 from Malcolmnixon/xr-body-tracker
XR: Add body tracking support.
- Loading branch information
Showing
11 changed files
with
1,324 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="XRBodyModifier3D" inherits="Node3D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> | ||
<brief_description> | ||
A node for driving body meshes from [XRBodyTracker] data. | ||
</brief_description> | ||
<description> | ||
This node uses body tracking data from a [XRBodyTracker] to animate the skeleton of a body mesh. | ||
</description> | ||
<tutorials> | ||
<link title="XR documentation index">$DOCS_URL/tutorials/xr/index.html</link> | ||
</tutorials> | ||
<members> | ||
<member name="body_tracker" type="StringName" setter="set_body_tracker" getter="get_body_tracker" default="&"/user/body""> | ||
The name of the [XRBodyTracker] registered with [XRServer] to obtain the body tracking data from. | ||
</member> | ||
<member name="body_update" type="int" setter="set_body_update" getter="get_body_update" enum="XRBodyModifier3D.BodyUpdate" is_bitfield="true" default="7"> | ||
Specifies the body parts to update. | ||
</member> | ||
<member name="bone_update" type="int" setter="set_bone_update" getter="get_bone_update" enum="XRBodyModifier3D.BoneUpdate" default="0"> | ||
Specifies the type of updates to perform on the bones. | ||
</member> | ||
<member name="show_when_tracked" type="bool" setter="set_show_when_tracked" getter="get_show_when_tracked" default="true"> | ||
If true then the nodes visibility is determined by whether tracking data is available. | ||
</member> | ||
<member name="target" type="NodePath" setter="set_target" getter="get_target" default="NodePath("")"> | ||
A [NodePath] to a [Skeleton3D] to animate. | ||
</member> | ||
</members> | ||
<constants> | ||
<constant name="BODY_UPDATE_UPPER_BODY" value="1" enum="BodyUpdate" is_bitfield="true"> | ||
The skeleton's upper body joints are updated. | ||
</constant> | ||
<constant name="BODY_UPDATE_LOWER_BODY" value="2" enum="BodyUpdate" is_bitfield="true"> | ||
The skeleton's lower body joints are updated. | ||
</constant> | ||
<constant name="BODY_UPDATE_HANDS" value="4" enum="BodyUpdate" is_bitfield="true"> | ||
The skeleton's hand joints are updated. | ||
</constant> | ||
<constant name="BONE_UPDATE_FULL" value="0" enum="BoneUpdate"> | ||
The skeleton's bones are fully updated (both position and rotation) to match the tracked bones. | ||
</constant> | ||
<constant name="BONE_UPDATE_ROTATION_ONLY" value="1" enum="BoneUpdate"> | ||
The skeleton's bones are only rotated to align with the tracked bones, preserving bone length. | ||
</constant> | ||
<constant name="BONE_UPDATE_MAX" value="2" enum="BoneUpdate"> | ||
Represents the size of the [enum BoneUpdate] enum. | ||
</constant> | ||
</constants> | ||
</class> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,307 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="XRBodyTracker" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> | ||
<brief_description> | ||
A tracked body in XR. | ||
</brief_description> | ||
<description> | ||
A body tracking system will create an instance of this object and add it to the [XRServer]. This tracking system will then obtain skeleton data, convert it to the Godot Humanoid skeleton and store this data on the [XRBodyTracker] object. | ||
Use [XRBodyModifier3D] to animate a body mesh using body tracking data. | ||
</description> | ||
<tutorials> | ||
<link title="XR documentation index">$DOCS_URL/tutorials/xr/index.html</link> | ||
</tutorials> | ||
<methods> | ||
<method name="get_joint_flags" qualifiers="const"> | ||
<return type="int" enum="XRBodyTracker.JointFlags" is_bitfield="true" /> | ||
<param index="0" name="joint" type="int" enum="XRBodyTracker.Joint" /> | ||
<description> | ||
Returns flags about the validity of the tracking data for the given body joint (see [enum XRBodyTracker.JointFlags]). | ||
</description> | ||
</method> | ||
<method name="get_joint_transform" qualifiers="const"> | ||
<return type="Transform3D" /> | ||
<param index="0" name="joint" type="int" enum="XRBodyTracker.Joint" /> | ||
<description> | ||
Returns the transform for the given body joint. | ||
</description> | ||
</method> | ||
<method name="set_joint_flags"> | ||
<return type="void" /> | ||
<param index="0" name="joint" type="int" enum="XRBodyTracker.Joint" /> | ||
<param index="1" name="flags" type="int" enum="XRBodyTracker.JointFlags" is_bitfield="true" /> | ||
<description> | ||
Sets flags about the validity of the tracking data for the given body joint. | ||
</description> | ||
</method> | ||
<method name="set_joint_transform"> | ||
<return type="void" /> | ||
<param index="0" name="joint" type="int" enum="XRBodyTracker.Joint" /> | ||
<param index="1" name="transform" type="Transform3D" /> | ||
<description> | ||
Sets the transform for the given body joint. | ||
</description> | ||
</method> | ||
</methods> | ||
<members> | ||
<member name="body_flags" type="int" setter="set_body_flags" getter="get_body_flags" enum="XRBodyTracker.BodyFlags" is_bitfield="true" default="0"> | ||
The type of body tracking data captured. | ||
</member> | ||
<member name="has_tracking_data" type="bool" setter="set_has_tracking_data" getter="get_has_tracking_data" default="false"> | ||
If [code]true[/code], the body tracking data is valid. | ||
</member> | ||
</members> | ||
<constants> | ||
<constant name="BODY_FLAG_UPPER_BODY_SUPPORTED" value="1" enum="BodyFlags" is_bitfield="true"> | ||
Upper body tracking supported. | ||
</constant> | ||
<constant name="BODY_FLAG_LOWER_BODY_SUPPORTED" value="2" enum="BodyFlags" is_bitfield="true"> | ||
Lower body tracking supported. | ||
</constant> | ||
<constant name="BODY_FLAG_HANDS_SUPPORTED" value="4" enum="BodyFlags" is_bitfield="true"> | ||
Hand tracking supported. | ||
</constant> | ||
<constant name="JOINT_ROOT" value="0" enum="Joint"> | ||
Root joint. | ||
</constant> | ||
<constant name="JOINT_HIPS" value="1" enum="Joint"> | ||
Hips joint. | ||
</constant> | ||
<constant name="JOINT_SPINE" value="2" enum="Joint"> | ||
Spine joint. | ||
</constant> | ||
<constant name="JOINT_CHEST" value="3" enum="Joint"> | ||
Chest joint. | ||
</constant> | ||
<constant name="JOINT_UPPER_CHEST" value="4" enum="Joint"> | ||
Upper chest joint. | ||
</constant> | ||
<constant name="JOINT_NECK" value="5" enum="Joint"> | ||
Neck joint. | ||
</constant> | ||
<constant name="JOINT_HEAD" value="6" enum="Joint"> | ||
Head joint. | ||
</constant> | ||
<constant name="JOINT_HEAD_TIP" value="7" enum="Joint"> | ||
Head tip joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_SHOULDER" value="8" enum="Joint"> | ||
Left shoulder joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_UPPER_ARM" value="9" enum="Joint"> | ||
Left upper arm joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_LOWER_ARM" value="10" enum="Joint"> | ||
Left lower arm joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_SHOULDER" value="11" enum="Joint"> | ||
Right shoulder joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_UPPER_ARM" value="12" enum="Joint"> | ||
Right upper arm joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_LOWER_ARM" value="13" enum="Joint"> | ||
Right lower arm joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_UPPER_LEG" value="14" enum="Joint"> | ||
Left upper leg joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_LOWER_LEG" value="15" enum="Joint"> | ||
Left lower leg joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_FOOT" value="16" enum="Joint"> | ||
Left foot joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_TOES" value="17" enum="Joint"> | ||
Left toes joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_UPPER_LEG" value="18" enum="Joint"> | ||
Right upper leg joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_LOWER_LEG" value="19" enum="Joint"> | ||
Right lower leg joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_FOOT" value="20" enum="Joint"> | ||
Right foot joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_TOES" value="21" enum="Joint"> | ||
Right toes joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_HAND" value="22" enum="Joint"> | ||
Left hand joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_PALM" value="23" enum="Joint"> | ||
Left palm joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_WRIST" value="24" enum="Joint"> | ||
Left wrist joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_THUMB_METACARPAL" value="25" enum="Joint"> | ||
Left thumb metacarpal joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_THUMB_PHALANX_PROXIMAL" value="26" enum="Joint"> | ||
Left thumb phalanx proximal joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_THUMB_PHALANX_DISTAL" value="27" enum="Joint"> | ||
Left thumb phalanx distal joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_THUMB_TIP" value="28" enum="Joint"> | ||
Left thumb tip joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_INDEX_FINGER_METACARPAL" value="29" enum="Joint"> | ||
Left index finger metacarpal joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_INDEX_FINGER_PHALANX_PROXIMAL" value="30" enum="Joint"> | ||
Left index finger phalanx proximal joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_INDEX_FINGER_PHALANX_INTERMEDIATE" value="31" enum="Joint"> | ||
Left index finger phalanx intermediate joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_INDEX_FINGER_PHALANX_DISTAL" value="32" enum="Joint"> | ||
Left index finger phalanx distal joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_INDEX_FINGER_TIP" value="33" enum="Joint"> | ||
Left index finger tip joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_MIDDLE_FINGER_METACARPAL" value="34" enum="Joint"> | ||
Left middle finger metacarpal joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_MIDDLE_FINGER_PHALANX_PROXIMAL" value="35" enum="Joint"> | ||
Left middle finger phalanx proximal joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_MIDDLE_FINGER_PHALANX_INTERMEDIATE" value="36" enum="Joint"> | ||
Left middle finger phalanx intermediate joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_MIDDLE_FINGER_PHALANX_DISTAL" value="37" enum="Joint"> | ||
Left middle finger phalanx distal joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_MIDDLE_FINGER_TIP" value="38" enum="Joint"> | ||
Left middle finger tip joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_RING_FINGER_METACARPAL" value="39" enum="Joint"> | ||
Left ring finger metacarpal joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_RING_FINGER_PHALANX_PROXIMAL" value="40" enum="Joint"> | ||
Left ring finger phalanx proximal joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_RING_FINGER_PHALANX_INTERMEDIATE" value="41" enum="Joint"> | ||
Left ring finger phalanx intermediate joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_RING_FINGER_PHALANX_DISTAL" value="42" enum="Joint"> | ||
Left ring finger phalanx distal joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_RING_FINGER_TIP" value="43" enum="Joint"> | ||
Left ring finger tip joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_PINKY_FINGER_METACARPAL" value="44" enum="Joint"> | ||
Left pinky finger metacarpal joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_PINKY_FINGER_PHALANX_PROXIMAL" value="45" enum="Joint"> | ||
Left pinky finger phalanx proximal joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_PINKY_FINGER_PHALANX_INTERMEDIATE" value="46" enum="Joint"> | ||
Left pinky finger phalanx intermediate joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_PINKY_FINGER_PHALANX_DISTAL" value="47" enum="Joint"> | ||
Left pinky finger phalanx distal joint. | ||
</constant> | ||
<constant name="JOINT_LEFT_PINKY_FINGER_TIP" value="48" enum="Joint"> | ||
Left pinky finger tip joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_HAND" value="49" enum="Joint"> | ||
Right hand joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_PALM" value="50" enum="Joint"> | ||
Right palm joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_WRIST" value="51" enum="Joint"> | ||
Right wrist joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_THUMB_METACARPAL" value="52" enum="Joint"> | ||
Right thumb metacarpal joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_THUMB_PHALANX_PROXIMAL" value="53" enum="Joint"> | ||
Right thumb phalanx proximal joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_THUMB_PHALANX_DISTAL" value="54" enum="Joint"> | ||
Right thumb phalanx distal joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_THUMB_TIP" value="55" enum="Joint"> | ||
Right thumb tip joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_INDEX_FINGER_METACARPAL" value="56" enum="Joint"> | ||
Right index finger metacarpal joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_INDEX_FINGER_PHALANX_PROXIMAL" value="57" enum="Joint"> | ||
Right index finger phalanx proximal joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_INDEX_FINGER_PHALANX_INTERMEDIATE" value="58" enum="Joint"> | ||
Right index finger phalanx intermediate joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_INDEX_FINGER_PHALANX_DISTAL" value="59" enum="Joint"> | ||
Right index finger phalanx distal joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_INDEX_FINGER_TIP" value="60" enum="Joint"> | ||
Right index finger tip joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_MIDDLE_FINGER_METACARPAL" value="61" enum="Joint"> | ||
Right middle finger metacarpal joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_MIDDLE_FINGER_PHALANX_PROXIMAL" value="62" enum="Joint"> | ||
Right middle finger phalanx proximal joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_MIDDLE_FINGER_PHALANX_INTERMEDIATE" value="63" enum="Joint"> | ||
Right middle finger phalanx intermediate joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_MIDDLE_FINGER_PHALANX_DISTAL" value="64" enum="Joint"> | ||
Right middle finger phalanx distal joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_MIDDLE_FINGER_TIP" value="65" enum="Joint"> | ||
Right middle finger tip joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_RING_FINGER_METACARPAL" value="66" enum="Joint"> | ||
Right ring finger metacarpal joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_RING_FINGER_PHALANX_PROXIMAL" value="67" enum="Joint"> | ||
Right ring finger phalanx proximal joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_RING_FINGER_PHALANX_INTERMEDIATE" value="68" enum="Joint"> | ||
Right ring finger phalanx intermediate joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_RING_FINGER_PHALANX_DISTAL" value="69" enum="Joint"> | ||
Right ring finger phalanx distal joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_RING_FINGER_TIP" value="70" enum="Joint"> | ||
Right ring finger tip joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_PINKY_FINGER_METACARPAL" value="71" enum="Joint"> | ||
Right pinky finger metacarpal joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_PINKY_FINGER_PHALANX_PROXIMAL" value="72" enum="Joint"> | ||
Right pinky finger phalanx proximal joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_PINKY_FINGER_PHALANX_INTERMEDIATE" value="73" enum="Joint"> | ||
Right pinky finger phalanx intermediate joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_PINKY_FINGER_PHALANX_DISTAL" value="74" enum="Joint"> | ||
Right pinky finger phalanx distal joint. | ||
</constant> | ||
<constant name="JOINT_RIGHT_PINKY_FINGER_TIP" value="75" enum="Joint"> | ||
Right pinky finger tip joint. | ||
</constant> | ||
<constant name="JOINT_MAX" value="76" enum="Joint"> | ||
Represents the size of the [enum Joint] enum. | ||
</constant> | ||
<constant name="JOINT_FLAG_ORIENTATION_VALID" value="1" enum="JointFlags" is_bitfield="true"> | ||
The joint's orientation data is valid. | ||
</constant> | ||
<constant name="JOINT_FLAG_ORIENTATION_TRACKED" value="2" enum="JointFlags" is_bitfield="true"> | ||
The joint's orientation is actively tracked. May not be set if tracking has been temporarily lost. | ||
</constant> | ||
<constant name="JOINT_FLAG_POSITION_VALID" value="4" enum="JointFlags" is_bitfield="true"> | ||
The joint's position data is valid. | ||
</constant> | ||
<constant name="JOINT_FLAG_POSITION_TRACKED" value="8" enum="JointFlags" is_bitfield="true"> | ||
The joint's position is actively tracked. May not be set if tracking has been temporarily lost. | ||
</constant> | ||
</constants> | ||
</class> |
Oops, something went wrong.