This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Basics
Rendering
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Version Control
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

Migrating to UNIGINE from Unity: Physics

While Unity software provides two physics engines: Physics and Physics2D, UNIGINE's built-in Physics module works only in 3 dimensions.

In UNIGINE, physics simulation can be enabled both when you enter Play mode and right in the editor. Click the Physics toggle in the top toolbar (if the button is greyed out, toggle Animation on via the button next to it):

To disable simulation and reset the state of all physics-driven objects, uncheck the toggle and the world will return to its previously saved state.

Rigid Bodies#

The Unity Rigidbody component is responsible for physical behaviour for GameObject.

In UNIGINE, some Object types are capable of being physics-driven. In the Physics tab of the Parameters window you can assign a Physical Body to an object, which can be considered physical approximations of real-life objects. One of them is Rigid Body simulating the most commonly used rigid body dynamics.

Global Physics settings, such as the global gravity vector and quality, are available in the Settings window compared to the Unity Physics section of the Project Settings:

Colliders / Shapes#

Collision Shapes in UNIGINE play the part of Unity Collider components, shapes are configured in the Shapes section. Here's the list of shape types compared to the Collider components:

Unity software UNIGINE
Box Collider Box
Sphere Collider Sphere
Capsule Collider Capsule
Cylinder
Mesh Collider Convex
Wheel Collider implemented as the Wheel Joint
Terrain Collider not provided, collisions are handled by the Terrain object itself
Notice
A Convex shape is generated automatically based on the object geometry, you don't need to specify a collision mesh explicitly. Also, it is possible to generate a set of convex hulls to define a more complex concave mesh by using the Autogenerated option.

The same way as you create Compound Collider in Unity Editor, you can combine several shapes to define a more complex collision shape in UNIGINE:

Colliders are also often used as triggers in Unity scripting.

Static Collider#

In Unity software, you would create GameObject that has Collider but no RigidBody to create a non-moving collider.

UNIGINE features two types of collisions, you can apply any option to make an object to be static collider:

  • Shape-Shape collision: between two objects with physical properties assigned (i.e. between their shapes).

    To create a static collider perform the following:

    1. Assign Dummy Body to the node.
    2. Add collision shapes.
  • Shape-Surface collision: between an object with physical properties assigned and a non-physical object (i.e. between a shape and a mesh surface).

    To make a mesh surface (e.g. of an ObjectMeshStatic) provide static collisions, just enable the Collision flag for it:

    Thus, you can really quickly enable collisions with the scene geometry, however, this method may be more performance consuming than the other one, especially if the world contains a large number of polygons.

Warning
Don't scale meshes that are going to participate in collision detection — physics doesn't work properly with scaled objects. To avoid scaling, reimport the mesh with the required scale.

Dynamic (Rigidbody) Collider#

In terms of Unity software, this is GameObject with Collider and a normal Ridigbody attached. Rigidbody collider is fully physics-driven and subject to collision and forces applied to it (either by other objects or from script).

To create such a collider object in UNIGINE, you assign Rigid Body to it and create the required set of Shapes to define its collision geometry.

Kinematic Collider#

Kinematic Collider is the term for an object that is logic-driven but affects other physically based objects in the scene (for example, a character or a door). In Unity software, such objects are created by enabling the IsKinematic property of the Rigidbody component.

In UNIGINE you should use an object surface with the Collision flag enabled to provide Shape-Surface collisions. When being moved (e.g. from code), such an object acts as a kinematic collider and influences physics-driven objects.

Layer-Based Collision Detection#

In Unity Editor, layer-based collision detection is defined by configuring the Collision Matrix in the Physics category of the Project Settings:

In UNIGINE, selective collision detection is controlled via Collision mask of both shapes and surfaces depending on the type of collision detection used:

Shape Collision Mask
Surface Collision Mask

Two objects will collide only if their Collision masks match (one bit at least).

For more details proceed to the dedicated article:

Joints#

As well as Unity software, UNIGINE provides support for Joints to connect physically-driven objects and restrict their movement relative to each other. Here is a list of Unity Joint components compared to the joint types available in UNIGINE:

Unity software UNIGINE
Character Joint Ball Joint
Configurable Joint
Fixed Joint Fixed Joint
Hinge Joint Hinge Joint
Spring Joint Prismatic Joint, Cylindrical Joint
implemented as Wheel Collider Wheel Joint, Suspension Joint
Path Joint
implemented as Cloth Constraints in the Cloth component Particles Joint

Ragdoll#

Unity Editor has a simple wizard that lets you create a ragdoll by automatically generating all Colliders, Rigidbodies and Joints.

In UNIGINE, Ragdoll is a special type of body used to simulate ragdoll dynamics. It operates on rigid bodies, shapes and joints to simulate limbs of an arbitrary skinned model. Ragdoll creation is available only for Skinned Mesh.

To switch between a bone-based animation and ragdoll simulation, use the Frame-based animation feature.

Physic Materials#

Unity Physic Materials contain a set of physical parameters used to adjust friction and bouncing effects of colliding objects.

In UNIGINE, the Friction and Restitution parameters are available for shapes and surfaces and taken into account depending on the type of collision detection used:

Shape Collision Mask
Surface Collision Mask

Character Controller#

In Unity software, Character Controller is mainly used for simplified simulation of a third-person or a first-person player dynamics without making use of Rigidbody physics. A Capsule Collider is used in collisions.

UNIGINE provides collision detection for players as well. You can enable the Collision flag for Spectator, Persecutor and Actor players, the latter is a counterpart of Unity Character Controller, its shape is also approximated by a capsule collider. With collisions enabled a player acts like both dynamic and kinematic object: it is controlled from script, affects dynamic colliders and can be blocked by static colliders at the same time.

Notice
For your convenience there is the CharacterController sample that you can take as an example of implementing Unity Character Controller functionality in UNIGINE and extend it if required.

Constant Force#

Unity Constant Force component is a quick utility providing a force constantly applied to a GameObject. It contains force and torque vector in relative and world coordinates.

In UNIGINE, you can use Physicals. These are objects inside of which there is an invisible force field affecting physics-driven objects. The Physical Wind is capable of applying a constant directed force to an object.

See Also#

Last update: 2023-11-03
Build: ()