Features

In this section we'll learn about the cool features that the Bullet plugin provides. At the end of the section you'll be able to control your RigidBody's parameters and properties on your scene.

RigidBody types and mass

Most of the physics engines (including Bullet) provides three types of rigid body behavior:

  • static

  • dynamic

  • kinematic

Thus we also made the same three types in ApertusVR. However currently it's recommended to use only the static and dynamic types, and now we only focused on these two as well. Static bodies has mass equal zero, and they're only movable by the user or an external controller (i.e. a plugin, as in the robot arm sample). Furthermore any other dynamic rigid body in the scene can collides with them, but can't push them. However dynamic bodies can bounce off from static bodies, and be pushed away by them. You can set your rigid body to static by the setToStatic() member function, this function also sets your mass to 0. In contrast, dynamic bodies has positive mass, and they can be pushed away by other bodies. You can set your rigid body to dynamic with the setToDynamic(float mass) function. Notice, that you must grant a mass parameter! If it isn't a positive value, your body's mass will be setted to 1.0 automatically, so pay attention on that. You can ask your rigid body about wich type it has currently with the getRBType() function. That returns with a RigidBodyType enum.

enum RigidBodyType
{
DYNAMIC,
STATIC,
KINEMATIC
};

Friciton, damping, restitution

These are the parameters that define your rigid body material, and thus control the behavior of it. Altough Bullet provides more parameters, for a simple simulation those must do all the work. Obviously you have a setter and getter for each of them in the IRigidBody interface.

RigidBody collider

Collision resulution is one of the most important part of a physics simulation. Furthermore this is the part where optimalisation takes place mostly. That means, you can improve your code by figuring out what collider shape fits the best for the putposes. In the case of primitive types the solution is trivial, since you have premade collider shapes for those geometries (and ApertusVR forces you to use only them). Anyway let's dicuss what about the complex meshes. We currently provide three options for the collider type, when working with GEOMETRY_INDEXEDFACESET . You can see them on the code sample:

enum RigidBodyColliderType
{
AUTO,
TRIANGLE_MESH,
CONVEX_HULL
};

The default value is alwaysAUTO , if modification doesn't take place. This means,that the plugin will make the decision instead of you. Hence, if you have a dynamic body, you'll get a CONVEX_HULL shape with it, since bullet doesn't support concave triangle mesh shape for dynamic bodies. On the other hand, if you creating static body, the plugin chooses the TRIANGLE_MESH option as automated decision, but you can always overwrite that when attaching the geometry. Maybe in the future there'll be more option to select from like bounding sphere, bounding box, capsule, and more...

Bouyancy

This parameter only tells the plugin that the user wants his/her rigid body be in some kind of liquid, and compute the bouyancy force for it or not. If the bouyancy property has been set true, then Bullet plugin automatically starts generating forces, once your body is under the liquid surface. The height of the liquid surface, and the liquid density are configured in the apeBullePlugin.json config file. Moreover the volume used in force generation is calculated automatically too. Hence your only concern is whether the body is in liquid or not.

This is the end of this section, so now you must be prepared to jump in the samples, and start to use Bullet plugin on your own.