Movement Controller

From C4 Engine Wiki
Jump to navigation Jump to search

The Movement Controller is a type of controller that causes a node to move forward and backward between two positions. The Movement Controller is built into the core engine, and it is one of four kinematic controllers that cause an object to follow an exact motion. Rigid bodies controlled by the Physics Manager are able to interact with kinematic objects, but they cannot stop kinematic objects or alter their motions. A kinematic object pushes rigid bodies out of its way no matter what.

Settings

The following settings are available for Movement Controllers.

Setting

Description

Kinematic Controller Settings

Wake intersecting rigid bodies

Specifies whether sleeping rigid bodies in the path of the kinematic object are detected and awakened. If this is disabled, then the kinematic object will pass straight through any sleeping rigid bodies that it comes in contact with. If this is enabled, then sleeping rigid bodies that intersect the bounding box of the kinematic object are automatically awakened so they can interact with the kinematic object. For best performance, this setting should be disabled if it's known that the kinematic object will not come in contact with sleeping rigid bodies.

Movement Controller Settings

Movement speed (m/s)

The speed at which the target node moves between two positions, measured in meters per second.

Acceleration time (s)

The length of time it takes for the target node to be accelerated to full speed when it starts moving.

Deceleration time (s)

The length of time it takes for the target node to be decelerated to a stop when it stops moving.

Start position connector key

The name of the connector attached to the target node that is connected to the start position for the movement.

Finish position connector key

The name of the connector attached to the target node that is connected to the finish position for the movement.

Script Functions

The Movement Controller defines the following functions that can be called from a script using the Call Controller Function method.

Function

Description

Get Movement Speed

Returns the movement speed and completes immediately.

Set Movement Speed

Sets the movement speed and completes immediately.

  • The Movement speed (m/s) setting specifies the new movement speed in meters per second.

Move to Start Position

Begins moving the target node to the start position. This function completes when the target node reaches the start position.

Move to Finish Position

Begins moving the target node to the finish position. This function completes when the target node reaches the finish position.

See Also