Physics Class Reference

#include <Physics.h>

List of all members.

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)
IShootablecastGunRay (const Vec3 &from, const Vec3 &to, Vec3 &collisionPoint, btRigidBody *ignore)
btCollisionWorld * getWorld ()
bool removeShootable (IShootable *shootable)

Detailed Description

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.


Constructor & Destructor Documentation

Physics::Physics (  ) 

Constructs the physics world

Definition at line 30 of file Physics.cpp.

Physics::~Physics (  ) 

Definition at line 52 of file Physics.cpp.


Member Function Documentation

void Physics::addNonShootable ( btRigidBody *  body  ) 

adds a body to the world. Bodies added by this method are not subject to bullet collision calculation.

See also:
IShootable
addShootable()

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.

See also:
addNonShootable()

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

Returns:
true if a non-world body 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

Returns:
true if the world has been hit. the resulting point is then written to collisionPoint

Definition at line 123 of file Physics.cpp.

btCollisionWorld * Physics::getWorld (  ) 
Returns:
the physics world

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

Parameters:
shootable the shootable object that should be removed
Returns:
true if

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.


The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.2