Suit mocap
Windows · Unity 6000.0.44f1 · Plugin 2.6.0 · Requires Teslasuit Studio
This example retargets a full-body Teslasuit motion stream onto a character in the scene. It shows how a motion provider, an avatar settings asset, and the human animator combine to move a rig in real time. The scene is TS/Examples/Scenes/Mocap/SuitMocap.unity.
What it demonstrates#
- Streaming full-body skeleton data through a
TsLiveMotionProvider. - Retargeting that skeleton onto a character with
TsHumanAnimator. - Mapping suit bones to character transforms with
TsAvatarSettings.
Scene setup#
The scene has a character (the Ethan model in the shipped example) with three pieces on or referenced by its root:
| Component or asset | Role |
|---|---|
TsSuitBehaviour | Discovers the suit and reports connection state. |
TsLiveMotionProvider | Starts the suit Mocap and exposes the live ISkeleton. |
TsHumanAnimator | Reads the skeleton each frame and applies bone rotations, plus hip position for the root. |
TsAvatarSettings | Maps each TsHumanBoneIndex to a named transform on the rig, and stores the I-pose rotations. |
The example's EthanAvatarSettings asset is bound to the Ethan model, so it is a reference only. For your own character you author a new avatar settings asset that maps the suit bones to your rig's transforms.
The key API pattern#
On start, TsHumanAnimator validates the avatar settings and caches the transform for each suit bone. Each frame it reads the skeleton and applies rotations relative to the I-pose.
private void Update()
{
var skeleton = m_motionProvider.GetSkeleton(Time.time);
foreach (var boneIndex in TsHumanBones.SuitBones)
{
var poseRotation = m_avatarSettings.GetIPoseRotation(boneIndex);
var targetRotation = Conversion.TsRotationToUnityRotation(
skeleton.GetBoneTransform(boneIndex).rotation);
// boneTransform.rotation = targetRotation * poseRotation
}
// root follows the hips position from the skeleton
}Setting the animator's IPose flag calibrates the provider, capturing the wearer's current stance as the reference pose. See Mocap concept for why calibration matters.
Authoring your own avatar settings#
- Create an asset from the menu
Assets/Create/Teslasuit/Motion/Avatar settings. - Assign your character model and fill in the bone-to-transform mapping. The editor validates that all required suit bones are configured.
- Reference the asset from a
TsHumanAnimatoron your rig, alongside aTsLiveMotionProvider.
Note. If the animator logs invalid or missing avatar settings, a required bone mapping is not set. TsAvatarSettings.IsValid must be true before the animator runs.
What to read next#
- Glove mocap: the hand equivalent of this workflow.
TsHumanAnimatorreference: retargeting API.- Mocap concept: skeletons, retargeting, and calibration.
