UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1

Unigine::Path Class

Interface for path manipulation.

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

Unigine::Path Class

Members


virtual ~Path ()

Virtual destructor.

static Ptr< Path > create ()

Path constructor.

Return value

Pointer to the created path.

static Ptr< Path > create (const char * name)

Path constructor.

Arguments

  • const char * name - The path name.

Return value

Pointer to the created path.

static Ptr< Path > create (const Ptr< Path > & path)

Path copy constructor.

Arguments

  • const Ptr< Path > & path - The path ponter.

Return value

Pointer to the created path.

virtual void grab () =0

Sets the owner flag to 1 for the Path pointer. The Path should not be handled by the engine after this function is called.

virtual void release () =0

Sets the owner flag to 0 for the Path pointer. The Path should be handled by the engine after this function is called.

virtual int isOwner () const =0

Returns the owner flag of the pointer. If the pointer is owner, on its deletion the object also will be deleted.

Return value

Returns the owner flag.

virtual int load (const char * name) const =0

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.

virtual int save (const char * name) const =0

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.

virtual void clear () const =0

Clears the path (including its times and frames).

virtual int addFrame () const =0

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

Return value

Number of path frames.

virtual void removeFrame () const =0

Removes the specified frame.

Return value

The frame number.

virtual void setNumFrames (int num) const =0

Sets the new number of frames.

Arguments

  • int num - Number of frames to be set.

virtual int getNumFrames () const =0

Returns the number of the path frames.

Return value

Number of path frames.

virtual void setFrameTime (int num, float time) const =0

Sets the time for the specified path frame.

Arguments

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

virtual float getFrameTime (int num) const =0

Returns the time of the specified path frame.

Arguments

  • int num - The frame number.

Return value

Frame time.

virtual void setFramePosition (int num, const vec3 & position) const =0

Sets the position coordinates for the path frame.

Arguments

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

virtual vec3 getFramePosition (int num) const =0

Returns the position coordinates of the path frame.

Arguments

  • int num - The frame number.

Return value

Coordinates of the frame.

virtual void setFrameRotation (int num, const quat & rotation) const =0

Sets the rotation quaternion for the given path frame.

Arguments

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

virtual quat getFrameRotation (int num) const =0

Returns the rotation quaternion of the given path frame.

Arguments

  • int num - The frame number.

Return value

Frame rotation quaternion.

virtual void setFrameScale (int num, const vec3 & scale) const =0

Sets the scaling vector for the path frame.

Arguments

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

virtual vec3 getFrameScale (int num) const =0

Returns the scaling vector of the path frame.

Arguments

  • int num - The frame number.

Return value

Frame scaling vector.

virtual void setFrameTransform (int num, const mat4 & transform) const =0

Sets the transformation matrix for the path frame.

Arguments

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

virtual mat4 getFrameTransform (int num) const =0

Returns the transformation matrix of the path frame.

Arguments

  • int num - The frame number.

Return value

Frame transformation matrix.

virtual vec3 getPosition (float time, int loop) const =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.

virtual quat getRotation (float time, int loop) const =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.

virtual vec3 getScale (float time, int loop) const =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.

virtual mat4 getTransform (float time, int loop) const =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.

virtual vec3 getLinearVelocity (float time, int loop) const =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.

virtual vec3 getAngularVelocity (float time, int loop) const =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.

virtual int getClosestFrame (const vec3 & position) const =0

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

Arguments

  • const vec3 & position - Coordinates of the point.

Return value

The closest frame number.

virtual float getClosestTime (const vec3 & position) const =0

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

Arguments

  • const vec3 & position - Coordinates of the point.

Return value

Path time in seconds.
Last update: 2017-07-03