This is simply a place for storing all the Physics Related functions. More...
#include <physicsmanager.h>
Public Types | |
|
typedef std::map< ObjectPair, Collision * >::iterator | CollisionIterator |
| Used to make working with the Collisions easier. | |
|
typedef std::map< ObjectPair, Collision * >::const_iterator | ConstCollisionIterator |
| Used to make working with the Collisions easier, and avoid the risk of accidentally changing them. | |
Public Member Functions | |
| PhysicsManager () | |
| Simple Constructor. | |
| PhysicsManager (const PhysicsConstructionInfo &Info) | |
| Simple Constructor. | |
| virtual | ~PhysicsManager () |
| Deconstructor. | |
| void | AddAreaEffect (AreaEffect *AE) |
| Adds an area effect to the world. | |
| void | AddConstraint (TypedConstraint *Constraint, bool DisableCollisions=false) |
| Adds a constraint to the world. | |
| void | AddWorldTrigger (WorldTrigger *Trig) |
| Adds a trigger to the world. | |
| CollisionIterator | BeginCollision () |
| Get an CollisionIterator to the first Collision. | |
| ConstCollisionIterator | BeginCollision () const |
| Get a ConstCollisionIterator to the first Collision. | |
| void | ClearPhysicsMetaData () |
| Clears all data relating to actors and other simulation objects from the physics world. | |
| void | DestroyAllAreaEffects () |
| Destroys all area effects currently in the manager. | |
| void | DestroyAllCollisions () |
| Destroys all collisions currently being stored and processed in the manager. | |
| void | DestroyAllConstraints () |
| Destroys all constraints currently in the manager. | |
| void | DestroyAllWorldTriggers () |
| Destroys all triggers currently in the manager. | |
| void | DoMainLoopItems (const Real &TimeElapsed) |
| This does all the work reuired for the main loop to process physics. | |
| virtual void | DoMainLoopItems () |
| CollisionIterator | EndCollision () |
| Get a CollisionIterator to one past the last Collision. | |
| ConstCollisionIterator | EndCollision () const |
| Get a ConstCollisionIterator to one past the last Collision. | |
| AreaEffect * | GetAreaEffect (const String &Name) |
| Gets an Area Effect by name. | |
| AreaEffect * | GetAreaEffect (const Whole &Index) |
| Gets an Area Effect by index. | |
| Collision * | GetCollision (ObjectPair *Pair) |
| Gets a Collision by object pair. | |
| unsigned short int | GetCollisionAge () |
| Gets the Collision Age limit. | |
| TypedConstraint * | GetConstraint (const Whole &Index) |
| Gets a constraint by index. | |
| int | GetDebugPhysicsRendering () |
| Is Physics Debug Drawing currently enabled? | |
| Whole | GetDebugPhysicsWireCount () |
| This gets how many WireFrames are being drawn. | |
| Vector3 | GetGravity () |
| Gets the gravity. | |
| Real | GetImpulse () |
| Gets the Collision Impulse limit. | |
| Whole | GetNumAreaEffects () |
| Gets the number of Area Effects currently in the world. | |
| Whole | GetNumCollisions () |
| Gets the number of Collisions currently in the world. | |
| Whole | GetNumConstraints () |
| Gets the number of constraints currently in the world. | |
| Whole | GetNumWorldTriggers () |
| Gets the number of triggers currently in the world. | |
| btSoftRigidDynamicsWorld * | GetPhysicsWorldPointer () |
| This returns a pointer to the bullet physics world. This is for internal use only. | |
| Vector3 | GetSoftGravity () |
| Gets the soft body gravity. | |
| virtual ManagerBase::ManagerTypeName | GetType () const |
| WorldTrigger * | GetWorldTrigger (const Whole &Index) |
| Gets a trigger by index. | |
| WorldTrigger * | GetWorldTrigger (const String &Name) |
| Gets a trigger by name. | |
| virtual void | Initialize () |
| void | PauseSimulation (bool Pause) |
| Pauses the simulation, preventing the physics world from taking action. | |
| void | RemoveAreaEffect (AreaEffect *AE) |
| Removes an area effect from the world. | |
| void | RemoveCollision (Collision *Col) |
| Removes an existing collision from the world. | |
| void | RemoveCollisionsContainingObject (WorldObject *Object) |
| Removes all stored collisions that involve the specified Object. | |
| void | RemoveConstraint (TypedConstraint *Constraint) |
| Removes a constraint from the world. | |
| void | RemoveWorldTrigger (WorldTrigger *Trig) |
| Removes a trigger from the world. | |
| void | ResetPhysicsWorld (PhysicsConstructionInfo *Info=0) |
| Resets all the internal physics structures in this manager. | |
| void | SetCollisionParams (const unsigned short int Age, Real Force) |
| Sets the Collision Parameters. | |
| void | SetDebugPhysicsRendering (int ToBeEnabled) |
| Enables and Disables Physics Debug Drawing. | |
| void | SetDebugPhysicsWireCount (Whole WireFrameCount_) |
| How many Wireframes do you want drawn from previous events. | |
| void | SetGravity (const Vector3 &pgrav) |
| Sets the gravity. | |
| void | SetIndividualGravity (ActorBase *Actor, const Vector3 &igrav) |
| Sets the gravity to be applied to a single object. | |
| void | SetSimulationSubstepModifier (const Whole &Modifier) |
| Sets the modifier to be used when stepping the physics simulation. | |
| void | SetSoftGravity (const Vector3 &sgrav) |
| Sets the gravity for soft bodies. | |
| bool | SimulationIsPaused () |
| Gets Whether or not the simulation is currently paused. | |
Friends | |
| class | CollisionDispatcher |
This is simply a place for storing all the Physics Related functions.
This is a place for storing items related to Debug physics drawing, Adding constraints, screwing with gravity and doing other physics Related features.
Definition at line 144 of file physicsmanager.h.
| Mezzanine::PhysicsManager::PhysicsManager | ( | ) |
Simple Constructor.
This constructor will assign some sane default values and will create a physics world that can be used immediately
Definition at line 426 of file physicsmanager.cpp.
| Mezzanine::PhysicsManager::PhysicsManager | ( | const PhysicsConstructionInfo & | Info | ) |
Simple Constructor.
This constructor will assign some sane default values and will create a physics world that can be used immediately
| Info | The construction info class with all the settings you wish the world to have. |
Definition at line 436 of file physicsmanager.cpp.
| Mezzanine::PhysicsManager::~PhysicsManager | ( | ) | [virtual] |
Deconstructor.
This deletes all those crazy pointers that Bullet, the physics subsystem need.
Definition at line 444 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::AddAreaEffect | ( | AreaEffect * | AE | ) |
Adds an area effect to the world.
Adds an area effect to the world so that it can/will take effect.
| AE | The area effect to be added. |
Definition at line 700 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::AddConstraint | ( | TypedConstraint * | Constraint, |
| bool | DisableCollisions = false |
||
| ) |
Adds a constraint to the world.
Adds the constraint to the world so that it can/will take effect.
| Constraint | The constraint to be added. |
| DisableCollisions | Sets whether or not the linked bodies collide with each other. |
Definition at line 661 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::AddWorldTrigger | ( | WorldTrigger * | Trig | ) |
Adds a trigger to the world.
Adds a trigger to the world so that it can/will take effect.
| Trig | The trigger to be added. |
Definition at line 751 of file physicsmanager.cpp.
| PhysicsManager::ConstCollisionIterator Mezzanine::PhysicsManager::BeginCollision | ( | ) | const |
Get a ConstCollisionIterator to the first Collision.
Definition at line 866 of file physicsmanager.cpp.
| PhysicsManager::CollisionIterator Mezzanine::PhysicsManager::BeginCollision | ( | ) |
Get an CollisionIterator to the first Collision.
Definition at line 856 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::ClearPhysicsMetaData | ( | ) |
Clears all data relating to actors and other simulation objects from the physics world.
This is best used with simulation cleanup.
Definition at line 965 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::DestroyAllConstraints | ( | ) |
Destroys all constraints currently in the manager.
In practice it is cleaner to remove constraints from the world before removing any constrained actors.
Definition at line 690 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::DoMainLoopItems | ( | const Real & | TimeElapsed | ) |
This does all the work reuired for the main loop to process physics.
| TimeElapsed | This is a real that represents the amount of time we need to simulate |
Definition at line 995 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::DoMainLoopItems | ( | ) | [virtual] |
The main loop calls this once per frame.
This is where each manager is expected to put anything that needs to be run each iteration of the main loop
Implements Mezzanine::ManagerBase.
Definition at line 1119 of file physicsmanager.cpp.
| PhysicsManager::ConstCollisionIterator Mezzanine::PhysicsManager::EndCollision | ( | ) | const |
Get a ConstCollisionIterator to one past the last Collision.
Definition at line 871 of file physicsmanager.cpp.
| PhysicsManager::CollisionIterator Mezzanine::PhysicsManager::EndCollision | ( | ) |
Get a CollisionIterator to one past the last Collision.
Definition at line 861 of file physicsmanager.cpp.
| AreaEffect * Mezzanine::PhysicsManager::GetAreaEffect | ( | const String & | Name | ) |
Gets an Area Effect by name.
| Name | The name of the area effect to find. |
Definition at line 706 of file physicsmanager.cpp.
| AreaEffect * Mezzanine::PhysicsManager::GetAreaEffect | ( | const Whole & | Index | ) |
Gets an Area Effect by index.
| Index | The index of the area effect you want. |
Definition at line 718 of file physicsmanager.cpp.
| Collision * Mezzanine::PhysicsManager::GetCollision | ( | ObjectPair * | Pair | ) |
Gets a Collision by object pair.
| Pair | A pair of objects. |
Definition at line 797 of file physicsmanager.cpp.
| unsigned short int Mezzanine::PhysicsManager::GetCollisionAge | ( | ) |
Gets the Collision Age limit.
Gets the CollisionAge used in filtering out collision contacts used to make events.
Definition at line 882 of file physicsmanager.cpp.
| TypedConstraint * Mezzanine::PhysicsManager::GetConstraint | ( | const Whole & | Index | ) |
Gets a constraint by index.
| Index | The index of the constraint you want. |
Definition at line 667 of file physicsmanager.cpp.
| int Mezzanine::PhysicsManager::GetDebugPhysicsRendering | ( | ) |
Is Physics Debug Drawing currently enabled?
lets you check if Physics Debug Drawing is enabled or not.
Definition at line 909 of file physicsmanager.cpp.
| Whole Mezzanine::PhysicsManager::GetDebugPhysicsWireCount | ( | ) |
This gets how many WireFrames are being drawn.
This will tell you how many frames worth of previous in game events are being drawn.
Definition at line 933 of file physicsmanager.cpp.
| Vector3 Mezzanine::PhysicsManager::GetGravity | ( | ) |
Gets the gravity.
Gets the currently set world gravity.
Definition at line 635 of file physicsmanager.cpp.
| Real Mezzanine::PhysicsManager::GetImpulse | ( | ) |
Gets the Collision Impulse limit.
Gets the Collision Impulse used in filtering out collision contacts used to make events.
Definition at line 887 of file physicsmanager.cpp.
| Whole Mezzanine::PhysicsManager::GetNumAreaEffects | ( | ) |
Gets the number of Area Effects currently in the world.
Definition at line 723 of file physicsmanager.cpp.
| Whole Mezzanine::PhysicsManager::GetNumCollisions | ( | ) |
Gets the number of Collisions currently in the world.
Definition at line 804 of file physicsmanager.cpp.
| Whole Mezzanine::PhysicsManager::GetNumConstraints | ( | ) |
Gets the number of constraints currently in the world.
Definition at line 672 of file physicsmanager.cpp.
| Whole Mezzanine::PhysicsManager::GetNumWorldTriggers | ( | ) |
Gets the number of triggers currently in the world.
Definition at line 773 of file physicsmanager.cpp.
| Vector3 Mezzanine::PhysicsManager::GetSoftGravity | ( | ) |
Gets the soft body gravity.
Gets the currently set soft body world gravity.
Definition at line 646 of file physicsmanager.cpp.
| ManagerBase::ManagerTypeName Mezzanine::PhysicsManager::GetType | ( | ) | const [virtual] |
This returns the type of this manager.
This is intended to make using and casting from Manager base easier. With this is is possible to cast from ManagerBase to the correct Manager Type.
Implements Mezzanine::ManagerBase.
Definition at line 1124 of file physicsmanager.cpp.
| WorldTrigger * Mezzanine::PhysicsManager::GetWorldTrigger | ( | const String & | Name | ) |
Gets a trigger by name.
| Name | The name of the trigger to find. |
Definition at line 756 of file physicsmanager.cpp.
| WorldTrigger * Mezzanine::PhysicsManager::GetWorldTrigger | ( | const Whole & | Index | ) |
Gets a trigger by index.
| Index | The index of the trigger you want. |
Definition at line 768 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::Initialize | ( | ) | [virtual] |
Configure Items requiring other Managers.
If you are using the Mezzanine::World this is called when Mezzanine::World::GameInit() is called. It is expected that by the time this is called either ManagerBase::ManagerBase(World*) or ManagerBase::SetGameWorld(World*) will have been called. This is where all configuration that requires atleast one other manager on the Mezzanine::World to exist.
Yes we know it is spelled wrong, but are Zs cooler anyway.
Implements Mezzanine::ManagerBase.
Definition at line 1114 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::PauseSimulation | ( | bool | Pause | ) |
Pauses the simulation, preventing the physics world from taking action.
| Pause | Wether or not to pause the simulation. |
Definition at line 620 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::RemoveAreaEffect | ( | AreaEffect * | AE | ) |
Removes an area effect from the world.
Removes an area effect from the world so that it will have no effect.
| AE | The area effect to be removed. |
Definition at line 728 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::RemoveCollision | ( | Collision * | Col | ) |
Removes an existing collision from the world.
| Col | The collision to be removed. |
Definition at line 809 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::RemoveCollisionsContainingObject | ( | WorldObject * | Object | ) |
Removes all stored collisions that involve the specified Object.
| Object | The Object which will have all of it's collisions removed. |
Definition at line 823 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::RemoveConstraint | ( | TypedConstraint * | Constraint | ) |
Removes a constraint from the world.
Removes a constraint from the world so that it will have no effect.
| Constraint | The constraint to be removed. |
Definition at line 677 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::RemoveWorldTrigger | ( | WorldTrigger * | Trig | ) |
Removes a trigger from the world.
Removes a trigger from the world so that it will have no effect.
| Trig | The trigger to be removed. |
Definition at line 778 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::ResetPhysicsWorld | ( | PhysicsConstructionInfo * | Info = 0 | ) |
Resets all the internal physics structures in this manager.
| Info | If you want to change the configuration of the world when restarting, you can optionally provide a new set of parameters to build the world with. |
Definition at line 941 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::SetCollisionParams | ( | const unsigned short int | Age, |
| Real | Force | ||
| ) |
Sets the Collision Parameters.
Sets the Collision Age and Force Filters used in filtering out collision contacts used to make events. The lower these numbers, the more events will be generated.
These numbers both default to 1.
| Age | The number of physics ticks the collision has to have existed to be used. Usually you want 1 or 2. Default: 1 |
| Force | The amount of force applied in the collision to filter by. This amount can vary more then the other param based on what you need. Default: 1.0 |
Definition at line 876 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::SetDebugPhysicsRendering | ( | int | ToBeEnabled | ) |
Enables and Disables Physics Debug Drawing.
Enables and Disables Physics Debug Drawing using default wireframes. This will force renderings that match the physics subsytem pixel for pixel.
| ToBeEnabled | 1 to turn it on, 0 to turn it off. There may be other options in the future, to enable fine tuned control |
Definition at line 893 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::SetDebugPhysicsWireCount | ( | Whole | WireFrameCount_ | ) |
How many Wireframes do you want drawn from previous events.
Each frame of the action gets its own wire frame, and how many of those back did you want to see? To see a minimal amount set this to 2, as the first wireframe is commonly entirely inside the the rendered 3d mesh. You can use World::GetTargetFrameTime() In conjunction with this to specify an amout of seconds worth of wireframes.
| WireFrameCount_ | This is a whole number that is the amount of wire frames you wan to see. Don't forget to be mindful of the framerate, Any amount more than just a few seconds worth can be cumbersome. |
Definition at line 922 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::SetGravity | ( | const Vector3 & | pgrav | ) |
Sets the gravity.
Sets the strength and direction of gravity within the world.
| pgrav | Vector3 representing the strength and direction of gravity. |
Definition at line 630 of file physicsmanager.cpp.
Sets the gravity to be applied to a single object.
This function does not change the global gravity, only how gravity behaves for this specific object. Note: This function only works on ActorRigid's.
| Actor | The actor whos gravity is to be changed. |
| igrav | The value of the gravity to be applied. |
Definition at line 652 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::SetSimulationSubstepModifier | ( | const Whole & | Modifier | ) |
Sets the modifier to be used when stepping the physics simulation.
| Modifier | The amount of substeps per frame to perform. |
Definition at line 990 of file physicsmanager.cpp.
| void Mezzanine::PhysicsManager::SetSoftGravity | ( | const Vector3 & | sgrav | ) |
Sets the gravity for soft bodies.
Gravity for soft bodies is stored separately from rigid bodies. So if you plan to use soft bodies in your game/simulation you need to call this function otherwise they won't fall.
| sgrav | Vector3 representing the strength and direction of gravity. |
Definition at line 641 of file physicsmanager.cpp.
| bool Mezzanine::PhysicsManager::SimulationIsPaused | ( | ) |
Gets Whether or not the simulation is currently paused.
Definition at line 625 of file physicsmanager.cpp.
1.7.3