class MAGES::MeshDeformations::SuturingRuntimeBehaviour

Overview

Runtime controller that creates and tightens sutures between configured puncture detector pairs. More…

class SuturingRuntimeBehaviour: public MonoBehaviour
{
public:
    // classes

    class SutureJointState;
    class SuturePair;

    // properties

    List<SuturePair> Sutures;
    GameObject Needle;
    Transform KnotPoint;
    float KnotStartDistance;
    float KnotPullDistance;
    IReadOnlyList CreatedSutureObjects;
    UnityEvent OnSuturingCompleted;

    // methods

    void Configure(
        IReadOnlyList<SuturePair> configuredSutures,
        GameObject configuredNeedle,
        Transform configuredKnotPoint,
        float configuredKnotStartDistance,
        float configuredKnotPullDistance
    );

    bool Begin(out string error);
    void StopSession(bool destroyCreatedSutures);
    void CompleteAllSutures(bool notifyCompletion);
};

Detailed Documentation

Runtime controller that creates and tightens sutures between configured puncture detector pairs.

Properties

List<SuturePair> Sutures

Gets or sets the configured detector pairs.

GameObject Needle

Gets or sets the needle object used for knot interaction.

Transform KnotPoint

Gets or sets the knot point.

float KnotStartDistance

Gets or sets the distance threshold for starting the knot.

float KnotPullDistance

Gets or sets the pull distance used to tighten the knot.

IReadOnlyList CreatedSutureObjects

Gets the suture objects created during the current session.

UnityEvent OnSuturingCompleted

Gets the callback invoked when the knot reaches completion.

Methods

void Configure(
    IReadOnlyList<SuturePair> configuredSutures,
    GameObject configuredNeedle,
    Transform configuredKnotPoint,
    float configuredKnotStartDistance,
    float configuredKnotPullDistance
)

Configures the runtime controller.

Parameters:

configuredSutures

The detector pairs to use.

configuredNeedle

The needle object.

configuredKnotPoint

The knot point.

configuredKnotStartDistance

The knot start threshold.

configuredKnotPullDistance

The knot pull distance.

bool Begin(out string error)

Starts a new suturing session.

Parameters:

error

The validation error, if any.

Returns:

True when the session is ready to run.

void StopSession(bool destroyCreatedSutures)

Stops the session and optionally removes the created suture objects.

Parameters:

destroyCreatedSutures

Whether to destroy the created suture objects.

void CompleteAllSutures(bool notifyCompletion)

Creates any missing sutures and fully tightens them immediately.

Parameters:

notifyCompletion

Whether to invoke the completion event.