shown in other instead.
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: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.
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.
- 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.
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.
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.
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 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.
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.