This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
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

Interface for path manipulation.

To use this class, include the UniginePath.h file.

Path Class

Members


Path ()

Constructor. Creates an empty path.

Path (const char * name)

Arguments

  • const char * name

Path (const Ptr<Path> & path)

Arguments

  • const Ptr<Path> & path

float getFrameTime (int num)

Returns the time of the specified path frame.

Arguments

  • int num - The frame number.

Return value

Frame time.

Math::mat4 getFrameTransform (int num)

Returns the transformation matrix of the path frame.

Arguments

  • int num - The frame number.

Return value

Frame transformation matrix.

void setNumFrames (int frames)

Sets the new number of frames.

Arguments

  • int frames - Number of frames to be set.

Math::vec3 getFramePosition (int num)

Returns the position coordinates of the path frame.

Arguments

  • int num - The frame number.

Return value

Coordinates of the frame.

int getNumFrames ()

Returns the number of the path frames.

Return value

Number of path frames.

void setFrameTransform (int num, const Math::mat4 & transform)

Sets the transformation matrix for the path frame.

Arguments

  • int num - The frame number.
  • const Math::mat4 & transform - Transformation matrix to be set.

Math::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. The default is 0 (path isn't looped).

Return value

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

Math::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 looped. The default is 0 (path isn't looped).

Return value

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

Math::quat getFrameRotation (int num)

Returns the rotation quaternion of the given path frame.

Arguments

  • int num - The frame number.

Return value

Frame rotation quaternion.

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

void setFrameScale (int num, const Math::vec3 & scale)

Sets the scaling vector for the path frame.

Arguments

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

void setFramePosition (int num, const Math::vec3 & pos)

Sets the position coordinates for the path frame.

Arguments

  • int num - The frame number.
  • const Math::vec3 & pos - Coordinates of the frame to be set.

void clear ()

Clears the path (including its times and frames).

Math::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. The default is 0 (path isn't looped).

Return value

Object rotation at the specified time.

int addFrame ()

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

Return value

Number of path frames.

float getClosestTime (const Math::vec3 & position)

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

Arguments

  • const Math::vec3 & position - Coordinates of the point.

Return value

Path time in seconds.

int save (const char * name)

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

Arguments

  • const char * name - The path name.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

void setFrameRotation (int num, const Math::quat & rot)

Sets the rotation quaternion for the given path frame.

Arguments

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

Math::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. The default is 0 (path isn't looped).

Return value

Object position coordinates at the specified time.

Math::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. The default is 0 (path isn't looped).

Return value

Object transformation matrix at the specified time.

int getClosestFrame (const Math::vec3 & position)

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

Arguments

  • const Math::vec3 & position - Coordinates of the point.

Return value

The closest frame number.

void removeFrame (int num)

Removes the specified frame.

Arguments

  • int num - The frame number.

int load (const char * name)

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

Arguments

  • const char * name - The path name.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

Math::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. The default is 0 (path isn't looped).

Return value

Object scale at the specified time.
Last update: 2017-07-03
Build: ()