Bullet Physics is a real-time Physics Engine for VR, games, roabotics, machine learning, etc… http://bulletphysics.org
Now, in WaveEngine 2.5.0, we have integrated Bullet Physics as 3D Physic engine. In previous versions, we use Bepu Physics (a C# physics library http://www.bepuphysics.com)
Keys of the new Physics 3D engine
New 3D Physic API
In Wave Engine 2.5.0 we have improved the 3D Physic API, adding new features and enhancing existing ones.
We’ve tried to maintain the name of Bullet properties and methods to facilitate the adoption of the new physics.
StaticBody3D and RigidBody3D
In previous versions, we only have the RigidBody3D component, which could be Kinematic. Now, we have introduced a new component called StaticBody3D. Next, we’ll try to explain its differences:
- RigidBody3D. This component is used for physics bodies that behave dynamically and must be updated every frame. A ball, bullet or a car could be good examples of rigid bodies. Additionally, a RigidBody3D can be Kinematic or Dynamic body (through the PhysicBodyType property):
- Dynamic (default value). The default rigid body type. These bodies are affected by collisions, joints, forces…
- Kinematic. If the body is kinematic, collisions, joints or forces will not affect this rigid body. However, the body will be affected by impulses or by specifying angular and linear velocities. A typical kinematic body could be a movable object in your level, a platform, opening door, etc.
- StaticBody3D. This component represents a physic body that isn’t moved by forces such as gravity, collisions or impulses. But other rigid bodies can collide with them. Typical static bodies are immovable objects like floors, walls, fences, etc. Every static mesh of your model could be a good candidate of static body.
Bodies – Collider3D relationship
In previous Wave Engine versions RigidBody3D component required to have a Collider3D component, and ONLY could have one collider.
Now, like in 2D Physics, this dependency is removed. You can have a PhysicBody (StaticBody3D or RigidBody3D) without a Collider3D, but as a counterpart, you can add to an entity all Colliders that you desire.
New 3D Colliders
In WaveEngine 2.5.0 we have included new Colliders. This is the collider list:
- Basic shape colliders (BoxCollider3D, SphereCollider3D, CapsuleCollider3D, CylinderCollider3D, ConeCollider3D). Creates basic convex shapes as colliders.
- MeshCollider3D. This collider takes a mesh from this entity and creates a collider with it. It has the IsConvex property, that modifies how
- IsConvex = true. It creates a convex hull mesh using the specified mesh. A convex mesh collider allows to collide with other Mesh Colliders.
- IsConvex = false. The collision is more accurate, but this collider could not be attached to a RigidBody3D (use a StaticBody3D instead).
New Joint3D features
Bullet Physics has several Joints that can be used to connect two bodies together. These joints can be used to simulate interaction between objects to form hinges, springs, chains, etc. Learning to use joints effectively helps to create a more engaging and interesting scene.
In previous WaveEngine versions, to specify joints with the Joints3DMap component, which store the list of joints associated to the entity, now we’ve removed that way of work.
Now each Joint is a Component itself, and you can add several Joints to an Entity in the same way as Collider3D instances. We have reimplemented all Joint3D properties to be more usable in Wave Editor, and now is more straightforward to adjust anchors, angle limits and much more.
Bullet offers a bunch of different queries for retrieving information about collision objects. A common use case is sensors needed by app logic components. For example, to find out if the space in front of an NPC object is blocked by a solid obstacle, or to find out if an NPC can see some other object.
- Ray Test. The simplest query. Shoot a ray from one position to another position. The ray test methods will then return a result object which contains information about which objects the ray has hit, the position and normal, etc.
- Sweep Test. Similar to Ray Test, with a subtle difference. The sweep test uses a convex shape which is moved along from the start position to the end position. Sweep test can for example be used to predict if an object would collide with an obstacle if it was moving to a specified position.
- Contact Test. Two kinds of contact tests. One which checks if a physic body is in contact with other physics bodies, and another that checks if a pair of bodies are in contact.
New Physics3D sample
We have published a new sample in the WaveEngine GitHub Sample repository: