NWAvatar
La référence est en anglais : elle est générée à partir des commentaires du code, écrits en anglais.
public class NWAvatar : MonoBehaviour, NodeWorld.Avatar.IAvatarViewpointProviderNamespace global.
Avatar descriptor for NodeWorld. Place on the root of any humanoid avatar. Auto-detects the full skeletal structure via Unity's Humanoid Avatar system (Animator.GetBoneTransform), validates the rig against IK requirements, computes body measurements from bone positions, and exposes a clean read-only API for the runtime IK and animation systems to consume. Detection is deterministic: no name matching, no hierarchy walking, no guessing. Every bone comes from Animator.GetBoneTransform which is Unity's authoritative humanoid bone mapping. Zero runtime cost after initialization (no Update/LateUpdate).
Fields
RequiredBones
public static readonly HumanBodyBones[] RequiredBonesThe 15 bones required for full-body IK: hips, spine, head, both arms (upper, lower, hand), both legs (upper, lower, foot).
OptionalBones
public static readonly HumanBodyBones[] OptionalBonesOptional non-finger bones. Missing ones produce individual warnings.
Properties
IsValid
public bool IsValid { get; }True if the rig passed validation: all required bones present, Animator is humanoid.
IsDetected
public bool IsDetected { get; }True after Detect has been called at least once.
Errors
public IReadOnlyList<string> Errors { get; }Hard failures — missing required bones, non-humanoid Animator, etc.
Warnings
public IReadOnlyList<string> Warnings { get; }Soft issues — missing optional bones, no eye bones, etc.
Animator
public Animator Animator { get; }The avatar's Animator component.
Measurements
public NWAvatarMeasurements Measurements { get; }Body measurements computed from bone positions at detection time.
SkinnedRenderers
public IReadOnlyList<SkinnedMeshRenderer> SkinnedRenderers { get; }Skinned mesh renderers found on this avatar.
VisemeMap
public NWVisemeMap VisemeMap { get; }Detected viseme blendshape map, or an empty map when none are available.
UsesManualVisemeMapping
public bool UsesManualVisemeMapping { get; }True when this avatar uses explicit inspector-assigned visemes.
ViewPosition
public Vector3 ViewPosition { get; set; }Viewpoint position in avatar-local space. Serialized, user-adjustable.
ViewpointWorldPosition
public Vector3 ViewpointWorldPosition { get; }Viewpoint position in world space.
HeadTrackingOffset
public Vector3 HeadTrackingOffset { get; }Offset from the viewpoint (eyes) to the head bone, in the avatar's space: the camera's space when the player looks straight ahead. Not in the head bone's space: its axes are those of the program the avatar was made in, not the camera's. Used when driving the IK head target so the XR camera sits at the avatar's eyes while the solver head target lands on the head bone.
HeadRotationInView
public Quaternion HeadRotationInView { get; }The head bone's rotation in the avatar's space: how the bone is turned when the camera looks straight ahead. The IK head target is the camera's rotation times this one; the camera's rotation alone turned the head, and the chest that follows it, on an avatar whose head bone does not have the camera's axes.
IsLocalPlayer
public bool IsLocalPlayer { get; set; }True if this avatar is driven by the local VR player. Set by NWAvatarController when the avatar is activated. Used by local-only systems such as first-person head culling.
Hips
public Transform Hips { get; }The hips bone from the Animator's humanoid mapping, or null when the avatar has none.
Spine
public Transform Spine { get; }The spine bone from the Animator's humanoid mapping, or null when the avatar has none.
Chest
public Transform Chest { get; }The chest bone from the Animator's humanoid mapping, or null when the avatar has none.
UpperChest
public Transform UpperChest { get; }The upper chest bone from the Animator's humanoid mapping, or null when the avatar has none.
Neck
public Transform Neck { get; }The neck bone from the Animator's humanoid mapping, or null when the avatar has none.
Head
public Transform Head { get; }The head bone from the Animator's humanoid mapping, or null when the avatar has none.
LeftShoulder
public Transform LeftShoulder { get; }The left shoulder bone from the Animator's humanoid mapping, or null when the avatar has none.
LeftUpperArm
public Transform LeftUpperArm { get; }The left upper arm bone from the Animator's humanoid mapping, or null when the avatar has none.
LeftLowerArm
public Transform LeftLowerArm { get; }The left lower arm bone from the Animator's humanoid mapping, or null when the avatar has none.
LeftHand
public Transform LeftHand { get; }The left hand bone from the Animator's humanoid mapping, or null when the avatar has none.
RightShoulder
public Transform RightShoulder { get; }The right shoulder bone from the Animator's humanoid mapping, or null when the avatar has none.
RightUpperArm
public Transform RightUpperArm { get; }The right upper arm bone from the Animator's humanoid mapping, or null when the avatar has none.
RightLowerArm
public Transform RightLowerArm { get; }The right lower arm bone from the Animator's humanoid mapping, or null when the avatar has none.
RightHand
public Transform RightHand { get; }The right hand bone from the Animator's humanoid mapping, or null when the avatar has none.
LeftUpperLeg
public Transform LeftUpperLeg { get; }The left upper leg bone from the Animator's humanoid mapping, or null when the avatar has none.
LeftLowerLeg
public Transform LeftLowerLeg { get; }The left lower leg bone from the Animator's humanoid mapping, or null when the avatar has none.
LeftFoot
public Transform LeftFoot { get; }The left foot bone from the Animator's humanoid mapping, or null when the avatar has none.
LeftToes
public Transform LeftToes { get; }The left toes bone from the Animator's humanoid mapping, or null when the avatar has none.
RightUpperLeg
public Transform RightUpperLeg { get; }The right upper leg bone from the Animator's humanoid mapping, or null when the avatar has none.
RightLowerLeg
public Transform RightLowerLeg { get; }The right lower leg bone from the Animator's humanoid mapping, or null when the avatar has none.
RightFoot
public Transform RightFoot { get; }The right foot bone from the Animator's humanoid mapping, or null when the avatar has none.
RightToes
public Transform RightToes { get; }The right toes bone from the Animator's humanoid mapping, or null when the avatar has none.
LeftEye
public Transform LeftEye { get; }The left eye bone from the Animator's humanoid mapping, or null when the avatar has none.
RightEye
public Transform RightEye { get; }The right eye bone from the Animator's humanoid mapping, or null when the avatar has none.
Jaw
public Transform Jaw { get; }The jaw bone from the Animator's humanoid mapping, or null when the avatar has none.
Methods
GetBone
public Transform GetBone(HumanBodyBones bone)Returns the cached Transform for a humanoid bone. O(1) array lookup. Returns null if the bone is not mapped in the humanoid Avatar.
HasBone
public bool HasBone(HumanBodyBones bone)True if the bone exists in the humanoid Avatar mapping.
Detect
public void Detect()Runs the full detection pipeline: finds the Animator, maps all humanoid bones, validates required bones, computes body measurements, and catalogues skinned renderers. Does NOT modify viewPosition — call AutoDetectViewpoint separately for that. Safe to call in both edit mode and play mode.
AutoDetectViewpoint
public Vector3 AutoDetectViewpoint()Computes the viewpoint position from eye bones (midpoint) or the head bone if no eyes are mapped. Returns the local-space position. Call this to populate or reset viewPosition: avatar.ViewPosition = avatar.AutoDetectViewpoint();
ApplyFirstPersonVisibility
public void ApplyFirstPersonVisibility(bool hide)Hides the head and what hangs from it for the local player's own view (first person), or shows it again.
