Skip to main content

AR51Character

MonoBehaviour · [RequireComponent(Animator)] Unity component
[RequireComponent(typeof(Animator))]
public class AR51Character : MonoBehaviour

Namespace: AR51.Unity.SDK

The component you add to a humanoid character prefab to make it drivable by the SDK. It validates the rig, maps Unity HumanBodyBones to its CharacterBones Transform map, exposes the VR device controllers, and is solved toward incoming skeleton data (body / foot / spine / finger IK) every frame. Add your finished prefab to SkeletonConsumer.CharacterPrefabs; the consumer instantiates one model per tracked person and owns the Person that drives it.

How-to

This page is reference (facts only). For the step-by-step connect → drive a character walkthrough, see the How-to guide.

Units

Unity positions and lengths are world-space Vector3 in meters; rotations are Quaternion; angles in degrees.

Properties

Public, Inspector-assigned unless noted. Assign the bone/controller Transforms on the prefab.

PropertyTypeDefaultDescription
Bone mapping
BonesCharacterBonesthe rig's bone-Transform map (see CharacterBones)
PersonPersonthe tracked person currently driving this character (set by the consumer)
WorldTransformthe space the character is solved in
LeftForearmTwistJointTransformoptional left wrist-twist bone
RightForearmTwistJointTransformoptional right wrist-twist bone
Device controllers
LeftDeviceControllerTransformTransform driven by the left VR controller
RightDeviceControllerTransformTransform driven by the right VR controller
Auto scale
CharacterHeightfloat1.0character height in meters, used by advanced non-uniform scaling
Foot contact
LeftFootBoundsTransformleft-foot contact-bounds Transform
RightFootBoundsTransformright-foot contact-bounds Transform
Runtime (read-mostly)
AnimatorAnimatorthe required humanoid Animator (read-only)
FootContactStickyFootContactStickyfoot-contact stick state (read-only)
MoveLimbsboolwhether limb IK is applied

Method summary

Instance

MethodReturns
ValidateCharacterboolUnity component
GetMissingRequiredMappingsList<string>Unity component
GetButtonStatusControllerButtonStatusUnity component
GetAllButtonStatusList<Tuple<ControllerButton, ControllerButtonStatus>>Unity component

Static

MethodReturns
GetOrderedLimbPairs(HumanBodyBones, HumanBodyBones)[]static

→ Full descriptions in Method details below.

Method details

ValidateCharacter

methodUnity component
public bool ValidateCharacter();

Checks that the prefab is a valid humanoid with all required bones and bounds assigned. Call it at setup (per prefab) before relying on a character — an invalid rig will not solve correctly.

Returnsbooltrue if the rig is a valid humanoid with the required bones mapped
Example
foreach (var prefab in SkeletonConsumer.Instance.CharacterPrefabs)
if (!prefab.ValidateCharacter())
Debug.LogError("Invalid rig: " + string.Join(", ", prefab.GetMissingRequiredMappings()));

GetMissingRequiredMappings

methodUnity component
public List<string> GetMissingRequiredMappings();

Returns the labels of the required bones/bounds that are not assigned. Use it to report exactly what a prefab is missing when ValidateCharacter returns false.

ReturnsList<string>labels of unassigned required bones/bounds; empty when the rig is complete

GetButtonStatus

methodUnity component
public ControllerButtonStatus GetButtonStatus(ControllerButton button, bool isLeft = false);
public List<Tuple<ControllerButton, ControllerButtonStatus>> GetAllButtonStatus(bool isLeft = false);

Read the VR controller button state for this character's person. GetButtonStatus reads one button; GetAllButtonStatus returns every button with its current status. Pass isLeft = true for the left controller.

Parameters
buttonControllerButtonwhich controller button to query
isLeftbooltrue for the left controller, false (default) for the right
ReturnsControllerButtonStatusthe current status of the requested button
note

ControllerButton and ControllerButtonStatus are transport enums (AR51.GRPC.CVS); they are surfaced here but not detailed as public types.

GetOrderedLimbPairs

methodstatic
public static (HumanBodyBones left, HumanBodyBones right)[] GetOrderedLimbPairs();

The canonical left/right HumanBodyBones limb pairs, in solve order — useful when iterating bones symmetrically.

Returns(HumanBodyBones, HumanBodyBones)[]the ordered left/right limb-bone pairs

CharacterBones

[Serializable] class Unity component
[Serializable]
public class CharacterBones

Namespace: AR51.Unity.SDK

The Inspector bone-Transform map assigned to AR51Character.Bones. Each field is a Transform on your rig that the solver drives; assign them in the Inspector (or let validation report any that are missing). Bones:

BoneTypeDescription
Core / spine
rootTransformrig root
HipsTransformhips / pelvis
SpineTransformspine
NeckTransformneck
headTransformhead
Left arm
LeftShoulderTransformleft shoulder
LeftElbowTransformleft elbow
LeftWristTransformleft wrist
Right arm
RightShoulderTransformright shoulder
RightElbowTransformright elbow
RightWristTransformright wrist
Left leg
LeftHipTransformleft hip
LeftKneeTransformleft knee
leftFootTransformleft foot
LeftToeTransformleft toe
Right leg
RightHipTransformright hip
RightKneeTransformright knee
rightFootTransformright foot
RightToeTransformright toe

These types support AR51Character but do not have their own page — see the Skeletons & Characters area page:

  • CharacterMapping — Inspector mapping from an entity id / display name to a character prefab.
  • CharacterMappingHelperTryFind extension that resolves a prefab by mapping name.
  • AutoScaleMode — how the character's bone lengths are rescaled to match the tracked person (Disabled / NonUniform / Uniform / AdvancedNonUniform).
  • CharacterValidation — rig-validation helpers (AR51.Unity.SDK.Utilities) used by ValidateCharacter.
Internal — not documented

The IK / character solver behind this component is proprietary and treated as a black box: the per-frame body/foot/spine/finger solve, bone-length auto-scaling, and the internal solver types (IKSolver and friends) are not part of the documented public surface. You assign the rig and call ValidateCharacter; the SDK drives it.

See also

Was this page helpful?