Humanoid Control for Unity v4
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Properties | List of all members
Passer.Humanoid.CustomTracker Class Reference

Description

A tracker wich can be used for custom tracking solutions.

This tracking option supports custom trackers and sensors for a humanoid. We support two types of tracking

BodySkeleton

This option is most suited for full body tracking hardware. An example implementation is the PerceptionNeuron extension found in the Humanoid Control Pro edition.

For this, you need to implement a class derived from the Passer::Tracking::BodySkeleton class. For the Perception Neuron extension, this new class is Passer::Tracking::PerceptionNeuron. This class should be used for the to the CustomTracker::bodySkeleton parameter:

In the new class, you should override the Passer::Tracking::BodySkeleton::Start and Passer::Tracking::BodySkeleton::Update functions and implement the functionality to correctly start the tracking and retrieving the new body pose. This will ensure that the tracking is started and updated at the right moment. In the update function, you can asssign the tracking result to the correct tracking bones of Humanoid Control. You can retrieve the Humanoid Control TrackedBone using the BodySkeleton::GetBone function. Then you can update the position and/or the rotation of the bone.

Important: a confidence value between 0 and 1 should also be set for the bone's position and/or rotation. The default confidence is 0 and in that case, the tracking information will not be used. Next to that, the Passer::Tracking::BodySkeleton::status should reflect the current tracking status of the device.

Example of updating one bone:

protected void UpdateBone(Bone boneId) {
TrackedBone bone = GetBone(boneId);
if (bone == null)
return;
// Get Perception Neuron tracking information
SensorBone neuronBone = device.GetBone(0, boneId);
// Assign the tracking position
bone.transform.position = neuronBone.position;
// Set the position Confidence
bone.positionConfidence = neuronBone.positionConfidence;
// Assign the tracking rotation
bone.transform.rotation = neuronBone.rotation;;
// Set the rotation Confidence
bone.rotationConfidence = neuronBone.rotationConfidence;
}

SensorComponents

This option is most suited for tracking devices which can be mounted on the body. An example implementation is the ViveTracker imnplementation found in the Humanoid Control Pro edition.

For this, you need to implement a class derived from the SensorComponent class. For the ViveTracker, this is the Passer::Tracking::ViveTrackerComponent. This class should be used on the Head, Hand, Hips and/or Foot Targets in the Sensor::sensorComponent parameter. Where applicable, selecting the bone in the dropdown determine to which bone the device is attached.

In the new class, you should override the SensorComponent::StartComponent and SensorComponent::UpdateComponent functions and implement the functionality to correctly start the tracking and retrieve the actual pose of the device. This will ensure that the tracking is started and updated at the right moment.

In the overridden SensorUpdate function, you should update the Transform of the SensorComponent.

Important: a confidence value between 0 and 1 should also be set for the device. The default confidence is 0 and in that case, the tracking information will not be used. Next to that, the SensorComponent::status should reflect the current tracking status of the device. Example of updating the device rotation and position:

public override void UpdateComponent() {
if (actionPose.poseIsValid) {
transform.localPosition = actionPose.localPosition;
transform.localRotation = actionPose.localRotation;
status = Tracker.Status.Tracking;
positionConfidence = 0.99F;
rotationConfidence = 0.99F;
}
else {
status = Tracker.Status.Present;
positionConfidence = 0F;
rotationConfidence = 0F;
}
}
A tracker.
Definition Tracker.cs:9
Status
The tracking status.
Definition Tracker.cs:13
Inheritance diagram for Passer.Humanoid.CustomTracker:
Passer.Humanoid.HumanoidTracker Passer.Tracking.Tracker

Public Types

enum  Status { Unavailable , Present , Tracking }
 The tracking status. More...
 

Public Member Functions

override void UpdateTracker ()
 Update the tracker state.
 
virtual void CheckTracker (HumanoidControl humanoid)
 Check the status of the tracker.
 
void CheckTracker (HumanoidControl humanoid, TrackerGetter getTracker)
 Function to check the status of a specific tracker.
 
void CheckTracker (HumanoidControl humanoid, TrackerGetter getTracker, Vector3 localPosition, Quaternion localRotation)
 Function to check the status of a specific tracker.
 
delegate TrackerComponent TrackerGetter (Transform transform, Vector3 localPosition, Quaternion localRotation)
 Function delegate for retrieving the tracker.
 
virtual Vector3 GetBonePosition (uint actorId, FacialBone boneId)
 
virtual Quaternion GetBoneRotation (uint actorId, FacialBone boneId)
 
virtual float GetBoneConfidence (uint actorId, FacialBone boneId)
 
virtual void StartTracker (HumanoidControl _humanoid)
 Start the tracker.
 
virtual void StartTracker ()
 Optional list of SubTrackers.
 
virtual void StopTracker ()
 Stop the tracker.
 
virtual void ShowTracker (bool shown)
 Show or hide the Tracker renderers.
 
virtual void Calibrate ()
 Calibrate the tracker.
 
virtual void AdjustTracking (Vector3 positionalDelta, Quaternion rotationalDelta)
 Adjust the position of the tracker by the given delat.
 

Public Attributes

BodySkeleton bodySkeleton
 A skeleton for the body.
 
HumanoidControl humanoid
 The humanoid for this tracker.
 
bool enabled
 Is this tracker enabled?
 
Status status
 The tracking Status of the tracker.
 
TrackerComponent trackerComponent
 The tracking device.
 

Protected Member Functions

void UpdateBodyFromSkeleton ()
 
virtual void UpdateTorso ()
 
virtual void UpdateLeftArm ()
 
virtual void UpdateRightArm ()
 
virtual void UpdateLeftLeg ()
 
virtual void UpdateRightLeg ()
 

Properties

override string name [get]
 
virtual HeadSensor headSensor [get]
 Get the sensor for the head.
 
virtual ArmSensor leftHandSensor [get]
 Get the sensor for the left hand.
 
virtual ArmSensor rightHandSensor [get]
 Get the sensor for the right hand.
 
virtual TorsoSensor hipsSensor [get]
 Get the sensor for the hips.
 
virtual LegSensor leftFootSensor [get]
 Get the sensor for the left foot.
 
virtual LegSensor rightFootSensor [get]
 Get the sensor for the right foot.
 
virtual HumanoidSensor[] sensors [get]
 The sensors for this tracker.
 

Member Enumeration Documentation

◆ Status

The tracking status.

Enumerator
Unavailable 

The tracking device is not available.

Present 

The tracking device is available but not tracking.

Tracking 

The tracking device is actively tracking.

Member Function Documentation

◆ UpdateTracker()

override void Passer.Humanoid.CustomTracker.UpdateTracker ( )
virtual

Update the tracker state.

Reimplemented from Passer.Tracking.Tracker.

◆ CheckTracker() [1/3]

virtual void Passer.Humanoid.HumanoidTracker.CheckTracker ( HumanoidControl  humanoid)
virtualinherited

Check the status of the tracker.

Parameters
humanoidThe humanoid for which the tracker needs to be checked

Reimplemented in Passer.Humanoid.LeapTracker, and Passer.Humanoid.UnityXRTracker.

◆ CheckTracker() [2/3]

void Passer.Humanoid.HumanoidTracker.CheckTracker ( HumanoidControl  humanoid,
TrackerGetter  getTracker 
)
inherited

Function to check the status of a specific tracker.

Parameters
humanoidThe humanoid for which the tracker needs to be checked
getTrackerFunction delegate to retrieve the tracker

The default position/rotation for the tracker when created will be zero

◆ CheckTracker() [3/3]

void Passer.Humanoid.HumanoidTracker.CheckTracker ( HumanoidControl  humanoid,
TrackerGetter  getTracker,
Vector3  localPosition,
Quaternion  localRotation 
)
inherited

Function to check the status of a specific tracker.

Parameters
humanoidThe humanoid for which the tracker needs to be checked
getTrackerFunction delegate to retrieve the tracker
localPositionThe default local position of the tracker
localRotationThe default local rotation of the tracker

◆ TrackerGetter()

delegate TrackerComponent Passer.Humanoid.HumanoidTracker.TrackerGetter ( Transform  transform,
Vector3  localPosition,
Quaternion  localRotation 
)
inherited

Function delegate for retrieving the tracker.

Parameters
transformThe root transform to start the searching of the tracker
localPositionThe default local position of the tracker
localRotationThe default local rotation of the tracker
Returns
The tracker component found or created

The default position/rotation is relative to the humanoid's real world.

◆ StartTracker() [1/2]

virtual void Passer.Humanoid.HumanoidTracker.StartTracker ( HumanoidControl  _humanoid)
virtualinherited

Start the tracker.

Reimplemented in Passer.Humanoid.LeapTracker, and Passer.Humanoid.UnityXRTracker.

◆ StartTracker() [2/2]

virtual void Passer.Tracking.Tracker.StartTracker ( )
virtualinherited

Optional list of SubTrackers.

Start the tracker

◆ StopTracker()

virtual void Passer.Tracking.Tracker.StopTracker ( )
virtualinherited

Stop the tracker.

Reimplemented in Passer.Humanoid.LeapTracker.

◆ ShowTracker()

virtual void Passer.Tracking.Tracker.ShowTracker ( bool  shown)
virtualinherited

Show or hide the Tracker renderers.

Parameters
shownRenderers are enabled when shown == true

◆ Calibrate()

virtual void Passer.Tracking.Tracker.Calibrate ( )
virtualinherited

Calibrate the tracker.

Reimplemented in Passer.Humanoid.UnityXRTracker.

◆ AdjustTracking()

virtual void Passer.Tracking.Tracker.AdjustTracking ( Vector3  positionalDelta,
Quaternion  rotationalDelta 
)
virtualinherited

Adjust the position of the tracker by the given delat.

Parameters
positionalDeltaThe positional delta to apply
rotationalDeltaThe rotational delta to apply

Member Data Documentation

◆ bodySkeleton

BodySkeleton Passer.Humanoid.CustomTracker.bodySkeleton

A skeleton for the body.

When this is set, the tracking will be taken from this skeleton

Property Documentation

◆ name

override string Passer.Humanoid.CustomTracker.name
get

◆ headSensor

virtual HeadSensor Passer.Humanoid.HumanoidTracker.headSensor
getinherited

Get the sensor for the head.

Will return null when this sensor is not present

◆ leftHandSensor

virtual ArmSensor Passer.Humanoid.HumanoidTracker.leftHandSensor
getinherited

Get the sensor for the left hand.

Will return null when this sensor is not present

◆ rightHandSensor

virtual ArmSensor Passer.Humanoid.HumanoidTracker.rightHandSensor
getinherited

Get the sensor for the right hand.

Will return null when this sensor is not present

◆ hipsSensor

virtual TorsoSensor Passer.Humanoid.HumanoidTracker.hipsSensor
getinherited

Get the sensor for the hips.

Will return null when this sensor is not present

◆ leftFootSensor

virtual LegSensor Passer.Humanoid.HumanoidTracker.leftFootSensor
getinherited

Get the sensor for the left foot.

Will return null when this sensor is not present

◆ rightFootSensor

virtual LegSensor Passer.Humanoid.HumanoidTracker.rightFootSensor
getinherited

Get the sensor for the right foot.

Will return null when this sensor is not present


The documentation for this class was generated from the following file: