#include <Physics.h>
Public Member Functions | |
Physics () | |
~Physics () | |
void | addShootable (IShootable *shootable) |
void | addNonShootable (btRigidBody *body) |
void | update (const float timeStep) |
bool | castRay (const Vec3 &from, const Vec3 &to, Vec3 &collisionPoint, btRigidBody *ignore) |
IShootable * | castGunRay (const Vec3 &from, const Vec3 &to, Vec3 &collisionPoint, btRigidBody *ignore) |
btCollisionWorld * | getWorld () |
bool | removeShootable (IShootable *shootable) |
This class provides phyics calculation using the Bullet Physics framework. The concrete physics models are created in the concerning classes (like World etc.) and MUST submit the phyics body to this this class using either
addShootable()
or
addNonShootable()
Definition at line 19 of file Physics.h.
Physics::Physics | ( | ) |
Constructs the physics world
Definition at line 30 of file Physics.cpp.
Physics::~Physics | ( | ) |
Definition at line 52 of file Physics.cpp.
void Physics::addNonShootable | ( | btRigidBody * | body | ) |
adds a body to the world. Bodies added by this method are not subject to bullet collision calculation.
Definition at line 78 of file Physics.cpp.
void Physics::addShootable | ( | IShootable * | shootable | ) |
adds a body to the world that are subject to bullet collision calculation.
Definition at line 88 of file Physics.cpp.
IShootable * Physics::castGunRay | ( | const Vec3 & | from, | |
const Vec3 & | to, | |||
Vec3 & | collisionPoint, | |||
btRigidBody * | ignore | |||
) |
shoot a bullet or laser ray and see if someone has been hit
Definition at line 146 of file Physics.cpp.
bool Physics::castRay | ( | const Vec3 & | from, | |
const Vec3 & | to, | |||
Vec3 & | collisionPoint, | |||
btRigidBody * | ignore | |||
) |
conducts a collision test to the physics world
Definition at line 123 of file Physics.cpp.
btCollisionWorld * Physics::getWorld | ( | ) |
Definition at line 181 of file Physics.cpp.
bool Physics::removeShootable | ( | IShootable * | shootable | ) |
Removes a shootable that has been added by addShootable(IShootable* shootable). This is needed to avoid
shootable | the shootable object that should be removed |
Definition at line 99 of file Physics.cpp.
void Physics::update | ( | const float | timeStep | ) |
updates the world physics
Definition at line 113 of file Physics.cpp.