What is a physic engine ?
The main feature of this physic engine is it's modularity. It is fully object oriented, and it's easy to derive new class and implement new forces, constraints, etc. Althought it is not really optimised yet, it use powerfull maths algorithms (sparse systems resolution, etc), and should be easy to tuned for real time applications.
Here are the main layers of the physic engine :
How to link a rigid body with \b Orion3D object ?
A particule system is a list of poncutal particules (class OR_Particule), that move according to ponctual mecanics.
How to use a particule system ?
The different kind of colliders
To track the collision between two objects (called the collidees), Orion3D uses colliders. According to the kind of objects pairs, there are for the moment two main different colliders :
OR_RigidBody. The class of this collider is OR_RigidBodyCollider.OR_Deflector_ABC) and a particule system (class OR_ParticuleManager or a derivated class such as OR_ParticuleSystem).OR_Collider_ABC and have to overload mainly one method : \begincode virtual void PerformCollisionDetection( OR_CollisionManager& CollisionManager )=0; This is the method that is called by the physic engine (in fact by the manager of colliders) to resolve the collision between the two collidee.
The main advantage of using collider is to provide a high level control over the way collision is performed. For example, collision between to object can easyly be turn on/off simply by disabling the collider (a complete list of such methods are provided by OR_Collider_ABC).
The rigid body collider use OPCODE collision detection library to check the collisions between its two rigid body collidee. To perform this task, it keeps in its internal two OPCODE objects that tracks the relative positions of the two rigid body :
AABBTreeCollider : this keeps track of the collision states between the two objects. To access the data of the two rigid body (mainly the vertex of the mesh that supports the rigid body), we assign to the TreeCollider a callback method.BVTCache : this cache is used by OPCODE to access it's information about the two objects. This information is packed in an opcode model (class OPCODE_Model).
Linkage between Orion3D and OPCODE
There are two kind of datas that OPCODE used :
AABBTreeCollider) and the collision cache (BVTCache). These datas are kept inside the rigid body colliders.OR_PhysicModel.OR_PhysicModel links the OPCODE model with Orion3D mesh. An OR_PhysicModel must be specified for each rigid body (class OR_RigidBody) that is used in a rigid body collider.
Orion3D Source Code Documentation
- Generated on 3 May 2002
- Copyright
© Gabriel
& Antoche