class MAGES::RigidBodyAnimation::RigidbodyMoveToTargetLocal

Overview

Rigidbody move to target in local space. More…

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

    Vector3 Target;
    GameObject RigidbodyTransformObj;
    float Speed;

    // methods

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

    void UpdateRigidBodyAnimation();
    void Restart(Vector3 newTargetPos, Quaternion newTargetRot);
    bool IsFinished();
    void Stop();
    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

Rigidbody move to target in local space.

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

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

Initializes a new instance of the RigidbodyMoveToTargetLocal class. RigidbodyMoveToTarget constructor.

Parameters:

targetPos

Target position.

trans

Gameobject to transform.

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 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.