TickInterpolator

Inherits: Node

Interpolates between network ticks for smooth motion.

Tutorials

Properties

Type Name Default
Node root
bool enabled true
String[] properties
bool record_first_state true
bool enable_recording true

Methods

Return Type Name
void process_settings()
void add_property(Variant node, String property)
bool can_interpolate()
void push_state()
void teleport()

Property Descriptions

Node root

The root node for resolving node paths in properties.


bool enabled = true

Toggles interpolation.


String[] properties

Properties to interpolate.


bool record_first_state = true

If enabled, takes a snapshot immediately upon instantiation, instead of waiting for the first network tick. Useful for objects that start moving instantly, like projectiles.


bool enable_recording = true

Toggle automatic state recording. When enabled, the node will take a new snapshot on every network tick. When disabled, call push_state whenever properties are updated.


Method Descriptions

void process_settings ( )

Process settings.

Call this after any change to configuration.


void add_property ( Variant node, String property )

Add a property to interpolate.

Settings will be automatically updated. The node may be a string or NodePath pointing to a node, or an actual Node instance. If the given property is already interpolated, this method does nothing.


bool can_interpolate ( )

Check if interpolation can be done.

Even if it's enabled, no interpolation will be done if there are no properties to interpolate.


void push_state ( )

Record current state for interpolation.

Note that this will rotate the states, so the previous target becomes the new starting point for the interpolation. This is automatically called if enable_recording is true.


void teleport ( )

Record current state and transition without interpolation.