Skip to content

TrackedBody

Inherits from: MonoBehaviour

Serialized Fields

Field Type Default Description
bodyId string Unique identifier for this tracked object
meshFilters List<MeshFilter> new List() MeshFilters containing the 3D model(s) to track. Multiple meshes will be combined using their local transforms.
trackedMotion TrackedMotion TrackedMotion.None Which degrees of freedom can be optimized when attached to parent. None = rigid attachment.
initialPoseSource InitialPoseSource InitialPoseSource.ScenePosition How to determine the initial pose for detection
initialViewpoint Transform Viewpoint transform to calculate initial pose from. The object's pose will be computed relative to this viewpoint.
isStationary bool Object is fixed in the world. Enables AR pose fusion to maintain position when tracking quality drops.
smoothTime float DEFAULT_SMOOTH_TIME Time in seconds to smooth pose corrections. 0 = instant.
rotationStability float 5000 Rotation stability (Tikhonov regularization). Higher = smoother rotation, slower response to rotation changes.
positionStability float 30000 Position stability (Tikhonov regularization). Higher = smoother position, slower response to position changes.
silhouetteTracking SilhouetteTrackingSettings (default) Silhouette tracking parameters.
multiScale MultiScaleSettings (default) Multi-scale pyramid settings. Adjust for thin objects at distance or when object appears small in image.
depthTracking DepthTrackingSettings (default) Advanced depth tracking tuning. Adjust when using RealSense depth camera.
useCustomStartThreshold bool Use custom quality threshold to start tracking. Default: 0.5
customQualityToStart float 0.5 Custom quality threshold (0-1) required to start tracking. Default is 0.5.
useCustomStopThreshold bool Use custom quality threshold to stop tracking.
customQualityToStop float 0.3 Custom quality threshold (0-1) below which tracking is lost. Default depends on modality.
assemblyMode bool Enable for parts that will be physically installed during operation. The child won't affect parent pose until quality confirms the part is present.
assemblyQualityToConfirm float 0.4 Quality threshold (0-1) required to confirm the part is installed and start affecting parent pose.
enableSilhouetteValidation bool Validate tracking points against silhouette boundaries. Uses shared silhouette renderer - significant GPU overhead on mobile.

Properties

Property Type Access Description
SilhouetteTracking SilhouetteTrackingSettings get Advanced edge tracking tuning settings. Adjust for difficult objects like thin tubes. Changes can be applied at runtime via UpdateEdgeTrackingParameters().
MultiScale MultiScaleSettings get Multi-scale pyramid settings. Adjust for thin objects at distance or when object appears small in image. Must be set before registration - runtime changes not currently supported.
DepthTracking DepthTrackingSettings get Advanced depth tracking tuning settings. Adjust when using RealSense depth camera. Must be set before registration - runtime changes not currently supported.
OcclusionSettings OcclusionSettings get Occlusion detection parameters for this body. Adjust threshold for tight assemblies where parts are close together.
EnableSilhouetteTracking bool get Whether silhouette tracking is active (derived from TrackingMethod).
EnableEdgeTracking bool get Whether edge tracking is active (derived from TrackingMethod).
EdgeTracking EdgeTrackingSettings get Edge tracking settings for tuning crease angle, search length, etc.
IsRegistered bool get
ParentBody TrackedBody get Parent body this object is attached to (null if independent).
HasParent bool get Whether this body has a parent assigned (for inspector visibility).
IsActiveMode bool get Whether this body has active tracking (at least one DOF enabled or no parent). True if no parent (always active) or if any TrackedMotion flags are set.
OnStartTracking UnityEvent get Event fired when tracking starts.
OnStopTracking UnityEvent get Event fired when tracking stops.
IsTracking bool get Whether this body is currently in the tracking state. All modes use quality-based state management with frame hysteresis.
ProjectionErrorAverage float get Averaged projection error over 30 frames (degrees).
EdgeCoverageAverage float get Averaged edge site coverage (valid/total) over 30 frames [0,1]. Ratio of valid edge points to total keyframe sites.
Visibility float get Visibility ratio (0-1). Ratio of visible silhouette lines.
DepthVisibility float get Depth visibility ratio (0-1). Ratio of valid depth points.
LastStatus FTBodyStatus get Raw status from native tracker.
IsSilhouetteValidationEnabled bool get Whether silhouette validation is currently enabled.
IsTextureTrackingEnabled bool get Whether texture tracking (feature-based tracking) is currently enabled.
IsOcclusionEnabled bool get Whether occlusion handling is currently enabled.
IsDepthTrackingEnabled bool get Whether depth tracking is currently enabled.
QualityToStartTracking float get
QualityToStopTracking float get
TrackingStatus TrackingStatus get
ContributesToOptimization bool get Whether this body currently contributes to optimization. When false, the body still tracks and computes quality metrics, but its observations don't affect the parent body's pose optimization.

Methods

Method Returns Description
FindParentInHierarchy() TrackedBody Find the nearest TrackedBody ancestor in Unity hierarchy (excluding self). Used internally and by editor for display.
ResetTracking() void
ExecuteDetection() void
ForceStartTracking() void Force-start tracking, bypassing quality-based auto-start. Useful for testing modalities that can't self-assess object presence (e.g. edge-only).
UpdateStabilityParameters() void Update stability (Tikhonov regularization) parameters at runtime. Call this after changing RotationStability or PositionStability while playing.
UpdateEdgeTrackingParameters() void Update edge tracking tuning parameters at runtime. Call this after changing EdgeTracking settings while playing.
UpdateOcclusionParameters() void Update occlusion detection parameters at runtime. Call this after changing OcclusionSettings while playing.
SetInitialPose(Transform viewpoint) void Set the initial pose from a viewpoint transform. The object's current world position is computed relative to the viewpoint. viewpoint: The viewpoint transform (e.g., camera position). If null, uses main camera.
SetInitialPose(Vector3 position, Quaternion rotation) void Set the initial pose from raw position and rotation values (camera-relative). position: Position relative to camera rotation: Rotation relative to camera
SetAttachmentPose(Vector3 childWorldPosition, Quaternion childWorldRotation) bool Set custom attachment pose using world-space position and rotation. Internally computes the relative pose to parent. If already attached, updates the pose immediately on native side. If not attached yet, the pose will be used when registering/attaching. childWorldPosition: Child's world-space position childWorldRotation: Child's world-space rotation Returns: True if successful (or stored for later use)
ClearCustomAttachmentPose() void Clear custom attachment pose override. If already attached, recomputes pose from current Unity hierarchy. If not attached yet, pose will be computed from hierarchy at registration time.
UpdateGeometry(IList<MeshFilter> newMeshFilters, TrackingModelAsset newTrackingModel = null) bool Update body geometry (mesh and silhouette model) at runtime while preserving tracking state. Use this to swap the visual representation without losing the current pose estimate. newMeshFilters: New mesh filters defining the geometry newTrackingModel: Pre-baked tracking model asset (silhouette + optional depth). Null for edge-only mode. Returns: True if geometry was successfully updated
SetTrackedMotion(TrackedMotion trackedMotion) bool Updates which degrees of freedom are tracked for this attached body. trackedMotion: New motion configuration (None = rigid) Returns: True if successfully updated
AddOccluder(TrackedBody occluder) bool Add another body as an occluder for this body. This body's tracking will ignore regions occluded by the occluder. Requires occlusion to be enabled on this body. occluder: The body that occludes this one Returns: True if successfully added
RemoveOccluder(TrackedBody occluder) bool Remove an occluder relationship. occluder: The body to remove as occluder Returns: True if successfully removed
EnableMutualOcclusion(TrackedBody other) bool Enable mutual occlusion between this body and another. Both bodies will occlude each other. other: The other body Returns: True if successfully enabled
DisableMutualOcclusion(TrackedBody other) bool Disable mutual occlusion between this body and another. other: The other body Returns: True if successfully disabled
SetContributesToOptimization(bool contributes) bool Set whether this body contributes to the optimization solution. When disabled, the body still gets its pose updated (follows parent if attached), but its gradient/hessian don't influence the parent's tracking. Use this for child bodies with low tracking quality. Only sends to native when state actually changes (efficient for per-frame calls). contributes: True to contribute, false to exclude from optimization Returns: True if successfully set
ComputeLocalBounds() Bounds Computes the combined local-space bounds of all mesh filters. Bounds are relative to this TrackedBody's transform.
GetEffectiveSphereRadius() float Gets the effective sphere radius for silhouette model generation. Returns the configured value if positive, otherwise computes auto value (0.8 x diameter).
GetViewpointCount() int Gets the number of viewpoints based on nDivides setting. Geodesic sphere vertex count: 10 * 4^n + 2
GetPointsPerView() int Gets the effective points per view.

Events

Event Type Description
OnPoseUpdated Action<Vector3, Quaternion> Event fired when pose is updated. Subscribe to receive pose updates without modifying TrackedBody.