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
Core Library
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Physics-Related Classes
Bounds-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-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.

Physics

Unigine real-time physics integrates collision detection, fracturing, buoyancy, joints and external physical forces to realistically simulate objects and complex interactions between them.

Physics simulation in Unigine is based on rigid body dynamics and is calculated for dynamic objects. Dynamic objects differ from static ones in that they have:

  • Physical body (or bodies)
  • Collision shape (or shapes)
Moreover, physical bodies can be connected by joints that restrict body movement relative each other. This way, it is possible to approximate complex objects like ragdolls or compound mechanical devices like cars.

Static objects do not have associated physical bodies, hence, no forces can be applied to them, and they are immovable. However, they still participate in contacts with dynamic objects and prevent physical bodies from going through.

Adding Physics

To ensure consistent frame rate, simulation is based on the approximate and simplified calculations (though there are a lot of parameters like linear and rotational velocities, acceleration, friction, applied forces, etc.). Remember, it is not real world physics, but rather fake physics with sufficient precision that looks convincing.

Notice
  • Do not scale any meshes in the world (static ones and physical objects) if you are going to simulate physics! Otherwise, collisions will not be calculated properly.
  • Physics approximation (i.e. approximation of objects by shapes) does not need to be absolutely accurate. Approximating with spheres instead of convex hulls is strongly recommended.

Global Physics Settings

Physics is simulated with its own FPS and is in effect within Physics simulation distance. (The rendering FPS can also be capped by the physics one). All other global physics-related settings are found in the Physics settings.

Physical Interaction

Most objects are not static decorations placed in the scene, they actively interact with each other, as the real object is the object of physics. It is unnatural and quite disappointing for the viewer to see the solid object inappropriately penetrating another one. Increasing the level of realism is thus unthinkable without proper approximation of the physical properties. On the other hand, there are still objects that do not require comprehensive modeling of their dynamics. The same duality goes for objects composite of many surface shapes. To compromise this fact, physical interaction is enabled on per-surface basis.

Collision Detection

Occupying a certain area in space, bouncing off the obstacles and even simply staying on the ground requires the collision detection. After checking the collision box, the surface participates in detecting, whether other objects come in contact with it and reacts correspondingly to the specified settings.

Collision Mask

For the collision detection to be more selective and at the same time alleviate the computational load, collision mask is set. For example, the object is indifferent to other objects actions and does not contribute to physical picture of the virtual world. Still, we want it to lie on the terrain, not to fall through it. Matching the bit masks of this object and the terrain (at least one bit in the masks should match), will get the desired effect.

Intersection Detection

Intersection serve a little different purposes, than collision. Intersection ray from one point to another allows lightweight and faster computing, if the surface is intersected. For example, computing collision of car wheels takes time and decreases maneuverability. If intersection will be used, the wheels are not represented with the properly reacting physical spheres, but rather rays, coming from the car body to the ground. And the problem of the plausible simulation will be solved.

Intersection Mask

Bit intersection mask allows to define the exact objects to be considered, when computing intersection, and disregard all the others, that have unmatched masks. It is a flexible tool, because only one bit in the masks should match. That means one object can easily participate in several different intersections simultaneously.

Last update: 2017-07-03
Build: ()