Skip to content
davido262 edited this page Nov 11, 2012 · 7 revisions

Description of the PhysicsWorld manager. Uses the Bullet Physics Engine.

Currently only rigid bodies are supported. If a rigid body has a mass of 0 it will act as a static body. This means that other physics objects will be able to collide in it, but it will not move. A RigidBody can have different collision shapes: a box, a sphere, a cylinder, a capsule, a cone, a convex hull (loaded from a model file) or a concave hull (loaded from a model file).

More functionality will be added on the future such as infinite planes, height maps, soft bodies and more.

Note: currently the concave hull crashes! Needs to be fixed, use a convex hull instead (and is faster too)

For more information please refer to the Official Bullet Physics site.

Initialization

It creates a btDbvtBroadphase, btDefaultCollisionConfiguration, btCollisionDispatcher, btSequentialImpulseConstraintSolver finally a btDiscreteDynamicsWorld. All the btCollisionShapes and btRigidBodys are added by each Component when created.

Shutdown

It iterates over all the stored btRigidBodys and btCollisionShapes and destroys them. It then destroys the rest of the allocated memory used to create the btDiscreteDynamicsWorld.

Update

Each frame, the stepSimulation function is called. It updates the internal physics simulation by the elapsed time. It then has to iterate over all the btRigidBodys and update the corresponding Entity's absolute position and absolute orientation. It only updates it if the btRigidBody is active, if it is asleep it skips it.

Clone this wiki locally