Image Component Library (ICL)
|
A physical world that handles physical objects. More...
#include <PhysicsWorld.h>
Public Types | |
enum | BulletSolverType { SequentialImpulseConstraintSolver, MLCP_Dantzig, NNCG, Lemke, Default = SequentialImpulseConstraintSolver } |
Public Member Functions | |
PhysicsWorld (BulletSolverType solver_type=Default) | |
constructor with given config file name More... | |
~PhysicsWorld () | |
Destructor. More... | |
void | addObject (PhysicsObject *obj) |
adds a physics object to the world (ownership is not passed) More... | |
void | removeObject (PhysicsObject *obj) |
removes the given physics object from the world More... | |
void | setGravity (const geom::Vec &gravity) |
sets the Gravity of the World More... | |
void | setGravityEnabled (bool on, const geom::Vec *useThisGravityIfOn=0) |
enables/disables gravity More... | |
void | splitImpulseEnabled (bool enable) |
enable splitImpulse More... | |
void | step (float dtSeconds=-1, int maxSubSteps=10, float fixedTimeStep=1.f/120.f) |
applies physical simulation for the given time step More... | |
double | getLastTimeDelta () |
returns the last delta of time in seconds as a double value. More... | |
bool | collideWithWorld (RigidObject *obj, bool ignoreJoints=true) |
check collision of an object with the world More... | |
void | setGroupCollision (int group0, int group1, bool collides) |
enables/disables collision between the group0 and group1 More... | |
bool | getGroupCollision (int group0, int group1) |
returns wether group0 and group1 collide More... | |
bool | rayCast (const geom::ViewRay &ray, float rayLength, PhysicsObject *&obj, geom::Vec &normal, geom::Vec &hitPoint) |
Return true if the ray hit and sets the pointer to the first object that was hit as well as the hit normal and hit point. More... | |
void | addConstraint (Constraint *constraint, bool disableCollisionWithLinkedBodies=false, bool passOwnerShip=false) |
adds a constraint to the world More... | |
void | removeConstraint (Constraint *constraint) |
removes a cosntraint from the world More... | |
const btSoftBodyWorldInfo * | getWorldInfo () const |
returns an internal world-info struct More... | |
btSoftBodyWorldInfo * | getWorldInfo () |
returns an internal world-info struct More... | |
Public Member Functions inherited from icl::utils::Lockable | |
Lockable (bool recursive=false) | |
Default constructor. More... | |
Lockable (const Lockable &l) | |
copy constructor (does not copy the source mutex) More... | |
Lockable & | operator= (const Lockable &l) |
assignment operator (does not copy the source mutex) More... | |
~Lockable () | |
Destructor. More... | |
void | lock () const |
lock object More... | |
void | unlock () const |
unlock object More... | |
Mutex & | getMutex () const |
returns mutex of this object More... | |
Protected Member Functions | |
void | removeContactPoints (PhysicsObject *obj) |
removes contactpoints (used when the collisionshape of an object has changed) More... | |
Protected Member Functions inherited from icl::utils::Uncopyable | |
Uncopyable () | |
Empty base constructor. More... | |
Private Member Functions | |
void | setSolver (BulletSolverType type) |
Private Attributes | |
Data * | data |
internal data pointer More... | |
Friends | |
class | PhysicsObject |
A physical world that handles physical objects.
icl::physics::PhysicsWorld::PhysicsWorld | ( | BulletSolverType | solver_type = Default | ) |
constructor with given config file name
icl::physics::PhysicsWorld::~PhysicsWorld | ( | ) |
Destructor.
void icl::physics::PhysicsWorld::addConstraint | ( | Constraint * | constraint, |
bool | disableCollisionWithLinkedBodies = false , |
||
bool | passOwnerShip = false |
||
) |
adds a constraint to the world
void icl::physics::PhysicsWorld::addObject | ( | PhysicsObject * | obj | ) |
adds a physics object to the world (ownership is not passed)
bool icl::physics::PhysicsWorld::collideWithWorld | ( | RigidObject * | obj, |
bool | ignoreJoints = true |
||
) |
check collision of an object with the world
bool icl::physics::PhysicsWorld::getGroupCollision | ( | int | group0, |
int | group1 | ||
) |
returns wether group0 and group1 collide
double icl::physics::PhysicsWorld::getLastTimeDelta | ( | ) |
returns the last delta of time in seconds as a double value.
const btSoftBodyWorldInfo* icl::physics::PhysicsWorld::getWorldInfo | ( | ) | const |
returns an internal world-info struct
btSoftBodyWorldInfo* icl::physics::PhysicsWorld::getWorldInfo | ( | ) |
returns an internal world-info struct
bool icl::physics::PhysicsWorld::rayCast | ( | const geom::ViewRay & | ray, |
float | rayLength, | ||
PhysicsObject *& | obj, | ||
geom::Vec & | normal, | ||
geom::Vec & | hitPoint | ||
) |
Return true if the ray hit and sets the pointer to the first object that was hit as well as the hit normal and hit point.
void icl::physics::PhysicsWorld::removeConstraint | ( | Constraint * | constraint | ) |
removes a cosntraint from the world
|
protected |
removes contactpoints (used when the collisionshape of an object has changed)
void icl::physics::PhysicsWorld::removeObject | ( | PhysicsObject * | obj | ) |
removes the given physics object from the world
void icl::physics::PhysicsWorld::setGravity | ( | const geom::Vec & | gravity | ) |
sets the Gravity of the World
void icl::physics::PhysicsWorld::setGravityEnabled | ( | bool | on, |
const geom::Vec * | useThisGravityIfOn = 0 |
||
) |
enables/disables gravity
When enabling gravity (on = true), either the given gravity value can be used or if useThisGravityIfOn is null, the default gravity (0,0, -9810) is used
void icl::physics::PhysicsWorld::setGroupCollision | ( | int | group0, |
int | group1, | ||
bool | collides | ||
) |
enables/disables collision between the group0 and group1
|
private |
void icl::physics::PhysicsWorld::splitImpulseEnabled | ( | bool | enable | ) |
enable splitImpulse
void icl::physics::PhysicsWorld::step | ( | float | dtSeconds = -1 , |
int | maxSubSteps = 10 , |
||
float | fixedTimeStep = 1.f/120.f |
||
) |
applies physical simulation for the given time step
If the given time interval tdSeconds is < 0, the actual time interval since the last call of this method is used
|
friend |
|
private |
internal data pointer