# Migrating to UNIGINE from Unreal Engine: Physics The physics system in *Unreal Engine* is powered by the *PhysX 3.3* physics engine, UNIGINE uses its own built-in [Physics](../../principles/physics/index.md) module. 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): ![](unigine_physics_toggle.png) 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. ## Enabling Collisions In *UE4*, any *PrimitiveComponent* (*ShapeComponent, StaticMeshComponent, SkeletalMeshComponent*, etc.) can be a physical object. *Unreal Engine* combines the concepts of the potentially physical and the potentially visible into *PrimitiveComponent*. In UNIGINE, the concepts for physics-driven object and visible geometry are separated. Some object types are capable of being physics-driven (e.g. *Static Mesh, Skinned Mesh, Water Mesh*, etc.). In the **Physics** tab of the *Parameters* window you can assign a [Physical Body](../../principles/physics/bodies/index.md) to an object, which can be considered physical approximations of real-life objects. One of them is **[Rigid Body](../../principles/physics/bodies/rigid/index.md)** simulating the most commonly used *rigid body dynamics*. **[Global Physics settings](../../editor2/settings/physics_global/index.md)**, such as the global gravity vector and quality, are available in the *Settings* window: ![](unigine_physics.png) ## Collisions / Shapes **[Collision Shapes](../../principles/physics/shapes/index.md)** in UNIGINE play the part of **Collisions** in *UE4*, shapes are assigned to a physical body in the *Shapes* section. Here's the list of shape types compared to the *UE4* Collisions: | Unreal Engine | UNIGINE | |---|---| | Box Simplified Collision | [Box](../../principles/physics/shapes/index.md#box) | | Sphere Simplified Collision | [Sphere](../../principles/physics/shapes/index.md#sphere) | | Capsule Simplified Collision | [Capsule](../../principles/physics/shapes/index.md#capsule) | | � | [Cylinder](../../principles/physics/shapes/index.md#cylinder) | | Auto Convex Collision | [Convex Hull](../../principles/physics/shapes/index.md#convex) | > **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](../../principles/physics/shapes/index.md#autogen)* option. You can combine several shapes to define a more complex collision shape in UNIGINE: ![](unigine_shapes.png) ### Static Collider UNIGINE features two [types of collisions](../../principles/physics/collision/index.md), 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). ![](shape_shape_icon.png) To create a static collider perform the following: 1. Assign a *[Dummy Body](../../principles/physics/bodies/dummy/index.md)* 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). ![](shape_surface_icon.png) To make a mesh surface (e.g. of *Static Mesh*) provide static collisions, just enable the **Collision** flag for it: ![](unigine_surface_collision.png) 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](../../editor2/fbx/index.md#fbx_scale). ### Dynamic (Rigidbody) Collider To create such a physics-driven collider object in UNIGINE, you assign a *[Rigid Body](../../principles/physics/bodies/rigid/index.md)* to it and create the required set of [Shapes](../../principles/physics/shapes/index.md) 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 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. ## Collision Channels In *UE4*, channel-based collision detection is defined by configuring the *Collision Responses* and *Trace Responses* settings: ![](ue_channels_collision.png) In UNIGINE, selective collision detection is controlled by the **[Collision](../../principles/bit_masking/index.md#collision_mask)** mask of both shapes and surfaces depending on the [type of collision detection](#physics_static) used: | ![](unigine_collision_mask_shape.png) | ![](unigine_collision_mask_surface.png) | |---|---| | *Shape Collision Mask* | *Surface Collision Mask* | Two objects will collide only if their *Collision* masks match (one bit at least). ![](../../content/optimization/physics/collision_filter.gif) For more details proceed to the dedicated article: - [Physics Optimization](../../content/optimization/physics/index.md#Collision) ## Constraints *Unreal Engine* Constraints are represented by **[Joints](../../principles/physics/joints/index.md)** in UNIGINE. Joints are used to connect physically-driven objects and restrict their movement relative to each other. While in *UE4* you configure constraints by pairing the *Stable Mesh* and the *Constrained Mesh* components, UNIGINE provides a set of joint types useful in different tasks: - [Ball Joint](../../principles/physics/joints/index.md#ball) - [Fixed Joint](../../principles/physics/joints/index.md#fixed) - [Hinge Joint](../../principles/physics/joints/index.md#hinge) - [Prismatic Joint](../../principles/physics/joints/index.md#prismatic), [Cylindrical Joint](../../principles/physics/joints/index.md#cylindrical) - [Wheel Joint](../../principles/physics/joints/index.md#wheel), [Suspension Joint](../../principles/physics/joints/index.md#suspension) - [Path Joint](../../principles/physics/joints/index.md#path) - [Particles Joint](../../principles/physics/joints/index.md#particles) ## Ragdoll In *Unreal Engine*, *Skeletal Mesh* can be subject to physics-driven animation in order to simulate a ragdoll, for this purpose it requires a *Physics Asset* set up and applied to it. In UNIGINE, **[Ragdoll](../../principles/physics/bodies/ragdoll/index.md)** 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](../../objects/objects/mesh_skinned_legacy/index.md)*. To switch between a bone-based animation and ragdoll simulation, use the **[Frame-based animation](../../principles/physics/bodies/ragdoll/index.md#enable)** feature. ## Physical Materials *UE4* uses **Physical Materials** to specify a set of physical parameters, such as friction and bouncing effects of colliding objects. In UNIGINE, the **Friction** and **Restitution** parameters are available for [shapes](../../principles/physics/shapes/index.md#shape_params) and [surfaces](../../editor2/node_parameters/physics/index.md#surface_physics) and taken into account depending on the [type of collision detection](#physics_static) used: | ![](unigine_physics_friction_shape.png) | ![](unigine_physics_friction_surface.png) | |---|---| | *Shape Collision Mask* | *Surface Collision Mask* | ## Vehicles In *UE4*, the **Wheeled Vehicle** Blueprint class covers the creation of vehicles. In UNIGINE, wheeled vehicles can be created either manually by using the *[Wheel Joint](../../principles/physics/joints/index.md#wheel)* or by using the [High-Level Car Physics](../../code/usage/vehicle_physics/index.md) system based on C++ components. ### See Also - Video Tutorial: [Physics](../../videotutorials/essentials/physics.md) - Principles of operation: [Physics](../../principles/physics/index.md)