This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

WorldTransform Class

This class is used to create a frame-based succession of tranformations from a loaded spline. For other nodes to move along with these transformations, they should be assigned as WorldTransform children.

WorldTransform Class

This class inherits from Node

Members


WorldTransform ()

Constructor. Creates a spline defined transformer in the world coordinates.

WorldTransform (string name)

Constructor. Creates a spline defined transformer in the world coordinates with a specified spline name.

Arguments

  • string name - Name of the spline.

int addFrame ()

Adds a new frame to the end of the spline defined transformer.

Return value

The added frame number.

vec3 getAngularVelocity (float time)

Returns the angular velocity of the child object moving along the spline at the specified time. If spline transformation is non-looped and the specified time is bigger than spline transformation, the last spline position will be returned. If spline transformation is looped, several loops can be used to count off time.

Arguments

  • float time - Time in seconds.

Return value

Object angular velocity.

int getClosestFrame (vec3 position)

Finds the spline frame which is the closest to the given reference point and returns its number.

Arguments

  • vec3 position - Coordinates of the reference point.

Return value

Frame number.

float getClosestTime (vec3 position)

Finds the spline point which is the closest to the given reference point and returns the spline transformation time in it.

Arguments

  • vec3 position - Coordinates of the reference point.

Return value

Spline transformation time in seconds.

vec3 getFramePosition (int num)

Returns the position coordinates of the spline in the specified frame.

Arguments

  • int num - Frame number.

Return value

Spline position coordinates in units.

quat getFrameRotation (int num)

Returns the rotation quaternion of the spline in the specified frame.

Arguments

  • int num - Frame number.

Return value

Spline rotation quaternion.

vec3 getFrameScale (int num)

Returns the scaling vector of the spline in the specified frame.

Arguments

  • int num - Frame number.

Return value

Spline scaling vector.

float getFrameTime (int num)

Returns the time of the specified spline frame.

Arguments

  • int num - Frame number.

Return value

Frame time.

mat4 getFrameTransform (int num)

Returns the transformation matrix of the spline in the specified frame.

Arguments

  • int num - Frame number.

Return value

Spline transformation matrix.

float getFrame ()

Returns the spline frame.

Return value

Time in seconds.

vec3 getLinearVelocity (float time)

Returns the linear velocity of the child object moving along the spline at the specified time. If spline transformation is non-looped and the specified time is bigger than spline transformation, the last spline position will be returned. If spline transformation is looped, several loops can be used to count off time.

Arguments

  • float time - Time in seconds.

Return value

Object linear velocity.

int getLoop ()

Returns a value indicating if the spline defined transformation is looped.

Return value

1 if the spline defined transformation is looped; otherwise, 0.

int getNumFrames ()

Returns the total number of frames.

Return value

The number of frames.

int getOrientation ()

Returns a value indicating if an object is oriented along the spline. The default is 1 (orient an object along the spline).

Return value

1 if an object is oriented along the spline; 0 if the object initial orientation is kept.

vec3 getPosition (float time)

Returns the position of the child object moving along the spline at the specified time. If spline transformation is non-looped and the specified time is bigger than spline transformation, the last spline position will be returned. If spline transformation is looped, several loops can be used to count off time.

Arguments

  • float time - Time in seconds.

Return value

Object position coordinates.

float getRadius ()

Returns the radius of applying the spline defined transformer (valid only outside the view frustum). If the child object transformed according to the spline gets outside the view frustum, but stays in the in the radius range, the playback of the transformation sequence does not stop.

Return value

Radius in units.

quat getRotation (float time)

Returns the rotation of the child object moving along the spline at the specified time. at the specified time. If spline transformation is non-looped and the specified time is bigger than spline transformation, the last spline position will be returned. If spline transformation is looped, several loops can be used to count off time.

Arguments

  • float time - Time in seconds.

Return value

Object rotation.

vec3 getScale (float time)

Returns the scale of the child object moving along the spline at the specified time. If spline transformation is non-looped and the specified time is bigger than spline transformation, the last spline position will be returned. If spline transformation is looped, several loops can be used to count off time.

Arguments

  • float time - Time in seconds.

Return value

Object scale.

float getSpeed ()

Returns the speed of spline defined transformation playback.

Return value

Speed of the spline defined transformation playback.

string getSplineName ()

Returns a name of the given spline.

Return value

The name of the spline.

float getTime ()

Returns the time of the spline defined transformation playback.

Return value

Time for spline transformation.

mat4 getTransform (float time)

Returns the transformation of the child object moving along the spline at the specified time. If spline transformation is non-looped and the specified time is bigger than spline transformation, the last spline position will be returned. If spline transformation is looped, several loops can be used to count off time.

Arguments

  • float time - Time in seconds.

Return value

Object transformation matrix.

int isPlaying ()

Returns a value indicating if the spline defined transformation is played.

Return value

1 if the spline defined transformation is played; otherwise, 0.

int isStopped ()

Returns a value indicating if the spline defined transformation is stopped.

Return value

1 if the spline defined transformation is stopped; otherwise, 0.

int load (string name)

Loads the specified spline for the transformer.

Arguments

  • string name - Name of the spline.

Return value

1 if the spline was successfully loaded; otherwise, 0.

void play ()

Continues playback of the spline defined transformation, if it was paused, or starts playback if it was stopped.

void removeFrame (int num)

Removes the specified frame.

Arguments

  • int num - Frame number.

int save (string name)

Saves the specified spline used for the transformer.

Arguments

  • string name - Name of the spline.

Return value

1 if the spline was successfully loaded; otherwise, 0.

void setFramePosition (int num, vec3 pos)

Sets position coordinates of the spline in the specified frame.

Arguments

  • int num - Frame number.
  • vec3 pos - Spline position coordinates in units.

void setFrameRotation (int num, quat rot)

Sets rotation quaternion for the spline in the specified frame.

Arguments

  • int num - Frame number.
  • quat rot - Spline rotation quaternion.

void setFrameScale (int num, vec3 scale)

Sets scaling vector for the spline in the specified frame.

Arguments

  • int num - Frame number.
  • vec3 scale - Spline scaling vector.

void setFrameTime (int num, float time)

Sets the time for the specified spline frame.

Arguments

  • int num - Frame number.
  • float time - Frame time.

void setFrameTransform (int num, mat4 transform)

Sets transformation matrix for the spline in the specified frame.

Arguments

  • int num - Frame number.
  • mat4 transform - Spline transformation matrix.

void setFrame (float time)

Sets a spline frame at the specified time.

Arguments

  • float time - Time in seconds.

void setLoop (int loop)

Sets a value indicating if the spline defined transformation should be looped.

Arguments

  • int loop - 1 to loop the spline defined transformation; 0 to play it only once (0 by default).

void setNumFrames (int num)

Adds the number of frames to the spline defined transformer.

Arguments

  • int num - Number of frames to be added.

void setOrientation (int orientation)

Sets a value indicating if an object should be oriented along the spline. The default is 1 (orient an object along the spline).

Arguments

  • int orientation - 1 to orient an object along the spline; 0 to keep the object initial orientation.

void setRadius (float radius)

Sets the radius for applying the spline defined transformer (valid only outside the view frustum). If the child object transformed according to the spline gets outside the view frustum, but stays in the in the radius range, the playback of the transformation sequence does not stop.

Arguments

  • float radius - Radius of the sphere in units.

void setSpeed (float speed)

Sets the speed of spline defined transformation playback. The default is 1.0.

Arguments

  • float speed - Speed of the spline defined transformation playback. Negative value controls reverse playback.

void setSplineName (string name)

Sets the name for the spline.

Arguments

  • string name - Name of the spline.

void setTime (float time)

Sets the time for spline defined transformation playback (0.0 by default).

Arguments

  • float time - Time for spline transformation.

void stop ()

Stops playback of the spline defined transformation. This function saves the playback position so that playing of the spline defined transformation can be resumed from the same point.
Last update: 03.07.2017
Build: ()