git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@271 92aac97c-a6ce-11dd-a772-7fcde58d38e6

This commit is contained in:
chappuis.daniel 2010-02-08 19:06:03 +00:00
parent 4a2a45eb72
commit 66e61bef74
4 changed files with 8 additions and 10 deletions

View File

@ -27,7 +27,7 @@
using namespace reactphysics3d;
// Constructor
CollisionEngine::CollisionEngine(CollisionWorld* world, const Time& timeStep)
CollisionEngine::CollisionEngine(PhysicsWorld* world, const Time& timeStep)
:DynamicEngine(world, timeStep) {
}
@ -38,20 +38,18 @@ CollisionEngine::~CollisionEngine() {
// Update the physics simulation
void CollisionEngine::update() {
CollisionWorld* collisionWorld = dynamic_cast<CollisionWorld*>(world);
assert(collisionWorld != 0);
// While the time accumulator is not empty
while(timer.getAccumulator() >= timer.getTimeStep().getValue()) {
// Remove all old collision contact constraints
collisionWorld->removeAllContactConstraints();
world->removeAllContactConstraints();
// Compute the collision detection
if (collisionDetection.computeCollisionDetection(collisionWorld)) {
if (collisionDetection.computeCollisionDetection(world)) {
// TODO : Delete this ----------------------------------------------------------
for (std::vector<Constraint*>::const_iterator it = collisionWorld->getConstraintListStartIterator(); it != collisionWorld->getConstraintListEndIterator(); ++it) {
for (std::vector<Constraint*>::const_iterator it = world->getConstraintListStartIterator(); it != world->getConstraintListEndIterator(); ++it) {
RigidBody* rigidBody1 = dynamic_cast<RigidBody*>((*it)->getBody1());
RigidBody* rigidBody2 = dynamic_cast<RigidBody*>((*it)->getBody2());
rigidBody1->setIsMotionEnabled(false);

View File

@ -39,7 +39,7 @@ class CollisionEngine : public DynamicEngine {
// ConstraintSolver constraintSolver; // Constraint solver
public :
CollisionEngine(CollisionWorld* world, const Time& timeStep); // Constructor
CollisionEngine(PhysicsWorld* world, const Time& timeStep); // Constructor
virtual ~CollisionEngine(); // Destructor
virtual void update(); // Update the physics simulation

View File

@ -27,7 +27,7 @@
using namespace reactphysics3d;
// Constructor
DynamicEngine::DynamicEngine(DynamicWorld* world, const Time& timeStep)
DynamicEngine::DynamicEngine(PhysicsWorld* world, const Time& timeStep)
:PhysicsEngine(world, timeStep) {
// Check if the pointer to the world is not NULL
if (world == 0) {

View File

@ -26,7 +26,7 @@
#include "../body/Body.h"
#include "../body/RigidBody.h"
#include "../body/BodyState.h"
#include "DynamicWorld.h"
#include "PhysicsWorld.h"
#include "../physics/physics.h"
// Namespace ReactPhysics3D
@ -46,7 +46,7 @@ class DynamicEngine : public PhysicsEngine {
void updateBodyState(RigidBody* const rigidBody, const Time& timeStep); // Update the state of a rigid body
public :
DynamicEngine(DynamicWorld* world, const Time& timeStep); // Constructor
DynamicEngine(PhysicsWorld* world, const Time& timeStep); // Constructor
DynamicEngine(const DynamicEngine& engine); // Copy-constructor
virtual ~DynamicEngine(); // Destructor