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

Unigine::Physics Class

Unigine physics. This interface provides access to Unigine physics functions.

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

Unigine::Physics Class

Members


virtual ~Physics ()

Virtual destructor.

static Physics * get ()

Returns a pointer to the existing physics.

Return value

Pointer to the existing physics.

virtual void setEnabled (int enable) const =0

Enable or disables physics simulation.

Arguments

  • int enable - 1 to enable physics, 0 to disable it.

virtual int isEnabled () const =0

Returns a value indicating if physics simulation is enabled. The default is 1.

Return value

Return 1 if physics is enabled; otherwise, 0.

virtual void setStable (int stable) const =0

Sets a value indicating if objects are updated in a definite order or not.

Arguments

  • int stable - 1 to indicate that the objects are updated in a definite order; 0 to indicate that the update order may change.

virtual int isStable () const =0

Returns a value indicating if objects are updated in a definite order or not. The default is 0 (the update order may change).

Return value

Returns 1 if the objects are updated in a definite order; otherwise 0.

virtual void setFixed (int fixed) const =0

Sets a flag to synchronize rendering FPS to physics one. Such FPS limitation allows to calculate physics each rendered frame (rather then interpolate it when this flag is set to 0). In this mode, there are no twitching of physical objects if they have non-linear velocities. If the rendering FPS is lower than the physics one, this flag has no effect.

Arguments

  • int fixed - 1 to cap rendering FPS to physics one; 0 to interpolate physics if rendering FPS is higher.

virtual int isFixed () const =0

Returns a flag indicating if rendering FPS is synchronized to physics one. Such FPS limitation allows to calculate physics each rendered frame (rather then interpolate it when this flag is set to 0). In this mode, there are no twitching of physical objects if they have non-linear velocities. If the rendering FPS is lower than the physics one, this flag has no effect.

Return value

Returns 1 if the rendering FPS is synchronized to physics one; 0 if the physics is interpolated if rendering FPS is higher.

virtual int saveScene () const =0

Saves the current physics scene (physical properties of all objects) into the buffer.

Return value

Scene buffer ID.

virtual int restoreScene (int id) const =0

Restores the previously saved physics scene from the buffer.

Arguments

  • int id - Buffer ID.

Return value

Returns 1 if the scene is restored successfully; otherwise, 0.

virtual int removeScene (int id) const =0

Removes the previously saved physics scene.

Arguments

  • int id - Buffer ID.

Return value

Returns 1 if the scene is removed successfully; otherwise, 0.

virtual int loadWorld (const XmlPtr & xml) const =0

Loads physics settings from the Xml.

Arguments

  • const XmlPtr & xml - Xml smart pointer.

Return value

Returns 1 if settings are loaded successfully; otherwise, 0.

virtual int saveWorld (const XmlPtr & xml) const =0

Saves physics settings into the Xml.

Arguments

  • const XmlPtr & xml - Xml smart pointer.

Return value

Returns 1 if settings are saved successfully; otherwise, 0.

virtual int saveState (const StreamPtr & stream) const =0

Saves physics settings into the stream.

Arguments

  • const StreamPtr & stream - Stream smart pointer.

Return value

Returns 1 if settings are saved successfully; otherwise, 0.

virtual int restoreState (const StreamPtr & stream) const =0

Restores physics settings from the stream.

Arguments

  • const StreamPtr & stream - Stream smart pointer.

Return value

Returns 1 if settings are restored successfully; otherwise, 0.
Last update: 2017-07-03
Build: ()