This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Path Class

Warning
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScript (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.

Interface for path loading, manipulating and saving.

The path is a spline along which an object can be moved. Such splines can be created, for example, in 3ds Max and then exported to a *.path file. Or, they can be created in the script by means of the Path class and then saved to the *.path file.

Warning
There is no connection between functions of the Path class and pathfinding-related functions.

Path Class

Members


static Path ( ) #

Constructor. Creates an empty path.

static Path ( string name ) #

Constructor. Creates an empty path of the specified name.

Arguments

  • string name - Name of the path.

vec3 getAngularVelocity ( float time, int loop = 0 ) #

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

Arguments

  • float time - Time in seconds.
  • int loop - Flag indicating if the path is close.

Return value

Angular velocity. If the number of frames is equal to 0 or 1, the function returns the (0,0,0) vector.

int getClosestFrame ( Vec3 position ) #

Returns the number of the path frame, which is the closest to the given point.

Arguments

  • Vec3 position - Coordinates of the point.

Return value

The closest frame number.

float getClosestTime ( Vec3 position ) #

Returns the path time in the path point which is the closest to the given point.

Arguments

  • Vec3 position - Coordinates of the point.

Return value

Path time in seconds.

void setFramePosition ( int num, Vec3 pos ) #

Sets the position coordinates for the path frame.

Arguments

  • int num - The frame number.
  • Vec3 pos - Coordinates of the frame to be set.

Vec3 getFramePosition ( int num ) #

Returns the position coordinates of the path frame.

Arguments

  • int num - The frame number.

Return value

Coordinates of the frame.

void setFrameRotation ( int num, quat rot ) #

Sets the rotation quaternion for the given path frame.

Arguments

  • int num - The frame number.
  • quat rot - Frame rotation quaternion to be set.

quat getFrameRotation ( int num ) #

Returns the rotation quaternion of the given path frame.

Arguments

  • int num - The frame number.

Return value

Frame rotation quaternion.

void setFrameScale ( int num, vec3 scale ) #

Sets the scaling vector for the path frame.

Arguments

  • int num - The frame number.
  • vec3 scale - Frame scaling vector to be set.

vec3 getFrameScale ( int num ) #

Returns the scaling vector of the path frame.

Arguments

  • int num - The frame number.

Return value

Frame scaling vector.

void setFrameTime ( int num, float time ) #

Sets the time for the specified path frame.

Arguments

  • int num - The frame number.
  • float time - Frame time to be set.

float getFrameTime ( int num ) #

Returns the time of the specified path frame.

Arguments

  • int num - The frame number.

Return value

Frame time.

void setFrameTransform ( int num, Mat4 transform ) #

Sets the transformation matrix for the path frame.

Arguments

  • int num - The frame number.
  • Mat4 transform - Transformation matrix to be set.

Mat4 getFrameTransform ( int num ) #

Returns the transformation matrix of the path frame.

Arguments

  • int num - The frame number.

Return value

Frame transformation matrix.

Vec3 getLinearVelocity ( float time, int loop = 0 ) #

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

Arguments

  • float time - Time in seconds.
  • int loop - Flag indicating if the path is looped.

Return value

Linear velocity. If the amount of frames is equal to 0 or 1, the function returns the (0,0,0) vector.

void setNumFrames ( int frames ) #

Sets the new number of frames.

Arguments

  • int frames - Number of frames to be set.

int getNumFrames ( ) #

Returns the number of the path frames.

Return value

Number of path frames.

Vec3 getPosition ( float time, int loop = 0 ) #

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

Arguments

  • float time - Time in seconds.
  • int loop - Flag indicating if the path is looped.

Return value

Object position coordinates.

quat getRotation ( float time, int loop = 0 ) #

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

Arguments

  • float time - Time in seconds.
  • int loop - Flag indicating if the path is looped.

Return value

Object rotation.

vec3 getScale ( float time, int loop = 0 ) #

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

Arguments

  • float time - Time in seconds.
  • int loop - Flag indicating if the path is looped.

Return value

Object scale.

Mat4 getTransform ( float time, int loop = 0 ) #

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

Arguments

  • float time - Time in seconds.
  • int loop - Flag indicating if the path is looped.

Return value

Object transformation matrix.

int addFrame ( ) #

Creates a new frame and appends it to the array of path frames.

Return value

Number of path frames.

void clear ( ) #

Clears the current path.

int load ( string name ) #

Loads the path with the given name and *.path extension.

Arguments

  • string name - Path name.

Return value

1 if the path is loaded successfully; otherwise, 0.

void removeFrame ( int num ) #

Removes the specified frame.

Arguments

  • int num - The frame number.

int save ( string name ) #

Saves the path under the given name with the *.path extension.

Arguments

  • string name - Path name.

Return value

1 if the path is saved successfully; otherwise, 0.
Last update: 2021-12-13
Build: ()