class MAGES::Interaction::HandPoser¶
Overview¶
A class to be attached on a hand to pose it. More…
class HandPoser: public MonoBehaviour { public: // properties int HandIndex; List<FingerPoser> FingerPosers; // methods void AddAutomaticColliders(); void LerpPose(HandPose p1, HandPose p2, float t); void SetHandPose( HandPose pose, Action<HandPose> onInterpolationFinished = null, float interpolationTime = 0.2f ); bool GetAutomaticHandPose( int layerMask, QueryTriggerInteraction triggerInteraction, HandPose extendedPose, HandPose retractedPose, HandPose hitPose, int iterations = 5, int subSteps = 10, PhysicsScene? physicsScene = null, float notCollidingFingerLerpFactor = -1f ); void GetCurrentPose(HandPose currentPose); };
Detailed Documentation¶
A class to be attached on a hand to pose it.
Properties¶
int HandIndex
Gets or sets the finger index for this finger poser.
List<FingerPoser> FingerPosers
Gets or sets the finger posers this hand poser is composed of.
Methods¶
void AddAutomaticColliders()
Adds automatic colliders to the hands.
void LerpPose(HandPose p1, HandPose p2, float t)
Lerps between the two poses.
Parameters:
p1 |
Pose 1. |
p2 |
Pose 2. |
t |
Interpolation factor. A value between 0 and 1. |
void SetHandPose( HandPose pose, Action<HandPose> onInterpolationFinished = null, float interpolationTime = 0.2f )
Sets the finger with the given pose.
This will stop any ongoing interpolation.
Parameters:
pose |
The pose to use for the finger. |
onInterpolationFinished |
Action to be called when the interpolation finished. i.e. after interpolationTime seconds. |
interpolationTime |
The time to interpolate between current pose and the given new one. |
bool GetAutomaticHandPose( int layerMask, QueryTriggerInteraction triggerInteraction, HandPose extendedPose, HandPose retractedPose, HandPose hitPose, int iterations = 5, int subSteps = 10, PhysicsScene? physicsScene = null, float notCollidingFingerLerpFactor = -1f )
Creates an automatic finger pose at the position the finger hits something by interpolating between the extended and retracted poses.
Parameters:
layerMask |
The collision layer mask. Use -1 for everything. |
triggerInteraction |
Whether or not to check for tirgger collisions. |
extendedPose |
The pose to start the interpolation from. |
retractedPose |
The pose to end the interpolation to. |
hitPose |
The hand pose output at the hit position. Function expects to get a valid HandPose instance to populate. |
iterations |
The iteractions to perform. |
subSteps |
The backwards substeps to perform in each iteration. |
physicsScene |
The physics scene to use for the simulation. If |
notCollidingFingerLerpFactor |
The factor to lerp the finger pose when not colliding. If < 0, will leave the finger at its current position. |
Returns:
true
if the finger hits something in the layerMask layer.
void GetCurrentPose(HandPose currentPose)
Gets the current pose of the finger.
Parameters:
currentPose |
The instance in which to store the pose. |