![]() |
Castle Battle
1.0
|
Physics class will handle all things related to collisions, creating Bullet physics objects and the physics simulation. More...
#include <physics.h>
Public Member Functions | |
Physics (const core::aabbox3df irrBox) | |
Default constructor, given a boundbix will create the opposite physics ground. More... | |
~Physics () | |
void | initWorld () |
Init physics instances of the World. More... | |
btTransform | getGround () |
Return ground transform. More... | |
void | UpdatePhysics (u32 delta, u32 fps) |
World step simulation. More... | |
void | UpdateRender (btRigidBody *btbody) |
Update graphic object transformation. More... | |
btRigidBody * | createCannonBall (scene::ISceneNode *node, core::vector3df position, f32 radius) |
Create the projectile physics instance. More... | |
btRigidBody * | createTreasure (scene::IMeshSceneNode *node, core::vector3df scale, core::vector3df position) |
Create the treasure physics instance. More... | |
btRigidBody * | createCastleBlock (scene::ISceneNode *node, core::vector3df rotation, core::vector3df scale, core::vector3df position) |
Create a castle block. More... | |
Private Attributes | |
btDiscreteDynamicsWorld * | World |
Type of discrete rigid body simulation. More... | |
std::list< btRigidBody * > | Objects |
List of btRigitBody instances. More... | |
btDefaultCollisionConfiguration * | collisionConfiguration |
Default collision system. More... | |
btBroadphaseInterface * | broadPhase |
Bounding box overlapping interface. More... | |
btCollisionDispatcher * | dispatcher |
Collision system dispatcher. More... | |
btSequentialImpulseConstraintSolver * | solver |
Internal bullet solver. More... | |
btTransform | ground |
Ground transform properties. More... | |
Physics class will handle all things related to collisions, creating Bullet physics objects and the physics simulation.
Remember that ONLY Bullet shape dimensions are x2 greater than Irrlicht unit. That means whenever you want to add an object from irrlicht extent you have to consider only half of it : irrSceneNode->getExtent() * 0.5f.
Physics::Physics | ( | const core::aabbox3df | irrBox | ) |
Default constructor, given a boundbix will create the opposite physics ground.
irrBox | aabbox3df irrlicht world bounding box |
Physics::~Physics | ( | ) |
btRigidBody * Physics::createCannonBall | ( | scene::ISceneNode * | node, |
core::vector3df | position, | ||
f32 | radius | ||
) |
Create the projectile physics instance.
node | ISceneNode graphic node |
position | vector3df position to set |
radius | f32 radius of the projectile |
btRigidBody * Physics::createCastleBlock | ( | scene::ISceneNode * | node, |
core::vector3df | rotation, | ||
core::vector3df | scale, | ||
core::vector3df | position | ||
) |
Create a castle block.
So it will be sensible to collision.
node | ISceneNoe node of the irrlicht graphic object. |
rotation | vector3df rotation of the object |
scale | vector3df scaling of the node passed. |
position | vector3df position of the object. |
btRigidBody * Physics::createTreasure | ( | scene::IMeshSceneNode * | node, |
core::vector3df | scale, | ||
core::vector3df | position | ||
) |
Create the treasure physics instance.
node | IMeshSceneNode mesh node of the irrlicht graphic object. |
scale | vector3df scaling of the node passed. |
position | vector3df position of the object. |
btTransform Physics::getGround | ( | ) |
Return ground transform.
void Physics::initWorld | ( | ) |
Init physics instances of the World.
Like ground, collision configuration, gravity and friction. A ground is created.
void Physics::UpdatePhysics | ( | u32 | delta, |
u32 | fps | ||
) |
World step simulation.
This must be sync with Irrlicht
DEPRECATED, MotionStateManager will handle this now!/
void Physics::UpdateRender | ( | btRigidBody * | btbody | ) |
Update graphic object transformation.
DEPRECATED, MotionStateManager will handle this now!/
|
private |
Bounding box overlapping interface.
|
private |
Default collision system.
|
private |
Collision system dispatcher.
|
private |
Ground transform properties.
|
private |
List of btRigitBody instances.
All this btRigidBody have a pointer to corresponding graphic object. This system is not used anymore.
|
private |
Internal bullet solver.
|
private |
Type of discrete rigid body simulation.