class MAGES::Interaction::FingerPoser

Overview

A class to be attached on a finger to pose it. More…

class FingerPoser: public MonoBehaviour
{
public:
    // properties

    int FingerIndex;
    List Bones;
    float FingerRadius;

    // methods

    void AddAutomaticColliders();
    void LerpPose(FingerPose p1, FingerPose p2, float t);
    void GetCurrentPose(FingerPose currentPose);
    void SetFingerPose(FingerPose pose, float interpolationTime = 0.2f);

    bool GetAutomaticFingerPose(
        int layerMask,
        QueryTriggerInteraction triggerInteraction,
        FingerPose extendedPose,
        FingerPose retractedPose,
        FingerPose hitPose,
        int iterations = 5,
        int subSteps = 10,
        PhysicsScene? physicsScene = null
    );
};

Detailed Documentation

A class to be attached on a finger to pose it.

Properties

int FingerIndex

Gets or sets the finger index for this finger poser.

List Bones

Gets or sets the bones of this finger.

float FingerRadius

Gets or sets the finger collision radius used for automatic posing.

Methods

void AddAutomaticColliders()

Adds automatic colliders to the finger.

void LerpPose(FingerPose p1, FingerPose 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 GetCurrentPose(FingerPose currentPose)

Gets the current pose of the finger.

Parameters:

currentPose

The instance in which to store the pose.

void SetFingerPose(FingerPose pose, 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.

interpolationTime

The time to interpolate between current pose and the given new one.

bool GetAutomaticFingerPose(
    int layerMask,
    QueryTriggerInteraction triggerInteraction,
    FingerPose extendedPose,
    FingerPose retractedPose,
    FingerPose hitPose,
    int iterations = 5,
    int subSteps = 10,
    PhysicsScene? physicsScene = null
)

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 finger pose at the hit position. Function expects to get a valid FingerPose instance to fill.

iterations

The iteractions to perform.

subSteps

The backwards substeps to perform in each iteration.

physicsScene

The physics scene to use for the simulation. If null wil use the default physics scene.

Returns:

true if the finger hits something int the layerMask layer.