Now, we will explore some basic ideas behind the vast Bullet library in the next sections.
Rigid bodies are the basic building block of all physics simulations. Like in the real world, a rigid body has some properties such as mass, position, velocity, inertia as well as motion states, and so on. The rigid body is assumed to be solid and thus incapable of being deformed by the exerting forces.
Like graphical meshes, collision shapes allow collision of a rich variety of different objects that one might encounter in the real world. Collision shapes don't have a world position; they are attached to collision objects or rigid bodies. The collision shape is for collisions only, and thus has no concept of mass, inertia, restitution, and so on. If you have many bodies that use the same collision shape, it is good practice to have only one Bullet collision shape, and share it among all those bodies. This helps save memory. Unlike graphical meshes, collision shapes are not always composed of triangles, but they can be represented as a primitive shape such as a box and a cylinder.
For more about collision shapes, visit the official manual at http://bulletphysics.org/mediawiki-1.5.8/index.php/Collision_Shapes.
MotionStates are a way for Bullet to do all the hard work for you by getting the objects being simulated into the rendering part of your program.
In most situations, your game loop would iterate through all the objects you're simulating before each frame render. For each object, you would update the position of the render object from the physics body. Bullet uses something called MotionStates to save you this effort.
MotionStates for objects communicate movement caused by forces in the physics simulation to your program. Static objects don't move, so there is no need to communicate movement. They don't need a motion state.
Kinematic objects are controlled by your program and the motion state works in reverse. It communicates movement of your object to Bullet so it can detect collisions with it.
You can visit the official documentation at http://bulletphysics.org/mediawiki-1.5.8/index.php/MotionStates.
In this physics engine, you can add and remove rigid bodies, set and apply properties to the bodies as well as the Bullet world itself, thereby creating a wonderful world similar to our living world inside our computer.
Being a feature-rich engine, there are more features to be explored, but that's not in the scope of this book. However, for in-depth information, you can download the manual at https://github.com/erwincoumans/bullet2/blob/master/Bullet_User_Manual.pdf?raw=true.
3.15.168.211