class MAGES::RigidBodyAnimation::RigidbodyMoveToTarget

Overview

RigidbodyMoveToTarget. More…

class RigidbodyMoveToTarget: public MAGES::RigidBodyAnimation::IRigidBodyAnimation
{
public:
    // properties

    Vector3 Target;
    GameObject RigidbodyTransformObj;
    float Speed;

    // methods

    RigidbodyMoveToTarget(
        Vector3 targetPos,
        GameObject trans,
        float speed,
        bool forceStart = false
    );

    void UpdateRigidBodyAnimation();
    void Restart(Vector3 newTargetPos, Quaternion newTargetRot);
    bool IsFinished();
    void Stop();
    void Pause();
    void Start();
    void OverrideDistanceThreshold(float distance);
};

Inherited Members

public:
    // properties

    GameObject RigidbodyTransformObj;
    float Speed;

    // methods

    void UpdateRigidBodyAnimation();
    void Stop();
    void Start();
    void Restart(Vector3 newTargetPos, Quaternion newTargetRot);
    bool IsFinished();

Detailed Documentation

RigidbodyMoveToTarget.

Properties

Vector3 Target

Gets or sets target to Translate to.

GameObject RigidbodyTransformObj

Gets or sets the object to be translated.

float Speed

Gets or sets translation speed.

Methods

RigidbodyMoveToTarget(
    Vector3 targetPos,
    GameObject trans,
    float speed,
    bool forceStart = false
)

Initializes a new instance of the RigidbodyMoveToTarget class.

Parameters:

targetPos

Target position.

trans

Object to interpolate.

speed

Interpolation speed.

forceStart

Start immediately.

void UpdateRigidBodyAnimation()

Updates the rigid body animation.

void Restart(Vector3 newTargetPos, Quaternion newTargetRot)

Restarts the animation.

Parameters:

newTargetPos

Target position.

newTargetRot

Target rotation.

bool IsFinished()

Checks if the animation has finished.

Returns:

True if the animation has finished, false otherwise.

void Stop()

Stops the animation.

void Pause()

Pause the animation.

void Start()

Starts the animation.

void OverrideDistanceThreshold(float distance)

Change distance threshold. When threshold is too close to 0 you may need to stop it manualy.

Parameters:

distance

Theshold must be positive.