从虚幻引擎迁移到UNIGINE:物理
The physics system in Unreal Engine is powered by the PhysX 3.3 physics engine, UNIGINE uses its own built-in Physics module.Unreal Engine中的物理系统由PhysX 3.3物理引擎提供动力,UNIGINE使用其自己的内置物理模块。
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中,既可以在进入Play模式时又可以在编辑器中启用物理模拟。单击顶部工具栏中的Physics开关(如果该按钮为灰色,则通过其旁边的按钮将Animation打开):
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.在UE4中,任何PrimitiveComponent(ShapeComponent, StaticMeshComponent, SkeletalMeshComponent等)都可以是物理对象。 Unreal Engine将潜在物理和潜在可见的概念组合到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 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.在UNIGINE中,物理驱动的对象和可见几何的概念是分开的。某些对象类型可以由物理驱动(例如Static Mesh, Skinned Mesh, Water Mesh等)。在Parameters窗口的Physics标签中,您可以分配一个身体物体,可以认为是现实生活中物体的物理近似。其中之一是Rigid Body,它模拟最常用的刚体动力学。
Global Physics settings, such as the global gravity vector and quality, are available in the Settings window:全局物理设置,例如全局重力矢量和质量,可在Settings窗口中找到:
Collisions / Shapes碰撞/形状#
Collision Shapes 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:碰撞形状在UNIGINE中,在UE4中扮演Collisions的角色,则将形状分配给Shapes部分中的实体。以下是与UE4碰撞相比的形状类型列表:
Unreal Engine | UNIGINE |
---|---|
Box Simplified Collision | Box |
Sphere Simplified Collision | Sphere |
Capsule Simplified Collision | Capsule |
— | Cylinder |
Auto Convex Collision | Convex Hull |
You can combine several shapes to define a more complex collision shape in UNIGINE:您可以组合多个形状以在UNIGINE中定义更复杂的碰撞形状:
Static Collider静态对撞机#
UNIGINE features two types of collisions, you can apply any option to make an object to be static collider:UNIGINE具有两个碰撞类型,您可以应用任何选项使对象成为静态对撞机:
-
Shape-Shape collision — between two objects with physical properties assigned (i.e. between their shapes).Shape-Shape碰撞-在分配了物理属性的两个对象之间(即,在它们的形状之间)。
To create a static collider perform the following:要创建静态对撞机,请执行以下操作:
- Assign a Dummy Body to the node.为该节点分配一个Dummy Body。
- 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碰撞-分配了物理属性的对象与非物理对象(即,形状和网格表面之间)之间的碰撞。
To make a mesh surface (e.g. of Static Mesh) provide static collisions, just enable the Collision flag for it:要使网格表面(例如Static Mesh)提供静态碰撞,只需为其启用Collision标志:
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.因此,您确实可以快速启用与场景几何体的碰撞,但是,这种方法可能比另一种方法消耗更多的性能,尤其是在世界包含大量多边形的情况下。
Dynamic (Rigidbody) Collider动态(刚体)对撞机#
To create such a physics-driven collider object in UNIGINE, you assign a Rigid Body to it and create the required set of Shapes to define its collision geometry.要在UNIGINE中创建这种由物理驱动的对撞机对象,您可以为其分配一个Rigid Body并创建所需的形状定义其碰撞几何。
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).Kinematic Collider是逻辑驱动的对象的术语,但会影响场景中其他基于物理的对象(例如角色或门).0_pht
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.在UNIGINE中,应使用启用了Collision标志的对象表面来提供Shape-Surface碰撞。在移动时(例如,从代码中移出),此类对象将充当运动对撞机并影响物理驱动的对象。
Collision Channels碰撞通道#
In UE4, channel-based collision detection is defined by configuring the Collision Responses and Trace Responses settings:在UE4中,通过配置Collision Responses和Trace Responses设置来定义基于通道的冲突检测:
In UNIGINE, selective collision detection is controlled by the Collision mask of both shapes and surfaces depending on the type of collision detection used:在UNIGINE中,选择性碰撞检测由形状和表面的Collision遮罩控制,具体取决于碰撞检测的类型用过的:
Shape Collision Mask |
Surface Collision Mask |
Two objects will collide only if their Collision masks match (one bit at least).仅当两个对象的Collision掩码匹配(至少一位)时,它们才会发生碰撞。
For more details proceed to the dedicated article:有关更多详细信息,请继续阅读专用文章:
Constraints约束条件#
Unreal Engine Constraints are represented by Joints 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:Unreal Engine约束表示为关节在UNIGINE中。关节用于连接物理驱动的对象并限制它们相对于彼此的运动。在UE4中,您可以通过将Stable Mesh和Constrained Mesh组件配对来配置约束,而UNIGINE提供了一组在不同任务中有用的关节类型:
RagdollRagdoll#
在Unreal Engine中,可以对Skeletal Mesh进行物理驱动的动画以模拟布娃娃,为此,它需要设置并应用Physics Asset。
在UNIGINE中,Ragdoll是一种特殊类型的实体,用于模拟布娃娃动力学。 它可以在刚体,形状和关节上运行,以模拟任意蒙皮模型的四肢。 布娃娃创建仅适用于Skinned Mesh。
要在基于骨骼的动画和布娃娃模拟之间切换,请使用Frame-based animation功能。
Physical Materials实物材料#
UE4 uses Physical Materials to specify a set of physical parameters, such as friction and bouncing effects of colliding objects.UE4使用“物理材料”指定一组物理参数,例如碰撞对象的摩擦和弹跳效果。
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:在UNIGINE中,Friction和Restitution参数可用于形状和表面并根据碰撞检测的类型用过的:
Shape Collision Mask |
Surface Collision Mask |
Vehicles车辆#
In UE4, the Wheeled Vehicle Blueprint class covers the creation of vehicles.在UE4中,Wheeled Vehicle Blueprint类涵盖了车辆的创建。
In UNIGINE, wheeled vehicles can be created either manually by using the Wheel Joint or by using the High-Level Car Physics system based on C++ components.在UNIGINE中,可以使用Wheel Joint手动创建轮式车辆,也可以使用高级汽车物理基于C ++组件的系统。