git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@271 92aac97c-a6ce-11dd-a772-7fcde58d38e6
This commit is contained in:
parent
4a2a45eb72
commit
66e61bef74
|
@ -27,7 +27,7 @@
|
||||||
using namespace reactphysics3d;
|
using namespace reactphysics3d;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
CollisionEngine::CollisionEngine(CollisionWorld* world, const Time& timeStep)
|
CollisionEngine::CollisionEngine(PhysicsWorld* world, const Time& timeStep)
|
||||||
:DynamicEngine(world, timeStep) {
|
:DynamicEngine(world, timeStep) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,20 +38,18 @@ CollisionEngine::~CollisionEngine() {
|
||||||
|
|
||||||
// Update the physics simulation
|
// Update the physics simulation
|
||||||
void CollisionEngine::update() {
|
void CollisionEngine::update() {
|
||||||
CollisionWorld* collisionWorld = dynamic_cast<CollisionWorld*>(world);
|
|
||||||
assert(collisionWorld != 0);
|
|
||||||
|
|
||||||
// While the time accumulator is not empty
|
// While the time accumulator is not empty
|
||||||
while(timer.getAccumulator() >= timer.getTimeStep().getValue()) {
|
while(timer.getAccumulator() >= timer.getTimeStep().getValue()) {
|
||||||
|
|
||||||
// Remove all old collision contact constraints
|
// Remove all old collision contact constraints
|
||||||
collisionWorld->removeAllContactConstraints();
|
world->removeAllContactConstraints();
|
||||||
|
|
||||||
// Compute the collision detection
|
// Compute the collision detection
|
||||||
if (collisionDetection.computeCollisionDetection(collisionWorld)) {
|
if (collisionDetection.computeCollisionDetection(world)) {
|
||||||
|
|
||||||
// TODO : Delete this ----------------------------------------------------------
|
// 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* rigidBody1 = dynamic_cast<RigidBody*>((*it)->getBody1());
|
||||||
RigidBody* rigidBody2 = dynamic_cast<RigidBody*>((*it)->getBody2());
|
RigidBody* rigidBody2 = dynamic_cast<RigidBody*>((*it)->getBody2());
|
||||||
rigidBody1->setIsMotionEnabled(false);
|
rigidBody1->setIsMotionEnabled(false);
|
||||||
|
|
|
@ -39,7 +39,7 @@ class CollisionEngine : public DynamicEngine {
|
||||||
// ConstraintSolver constraintSolver; // Constraint solver
|
// ConstraintSolver constraintSolver; // Constraint solver
|
||||||
|
|
||||||
public :
|
public :
|
||||||
CollisionEngine(CollisionWorld* world, const Time& timeStep); // Constructor
|
CollisionEngine(PhysicsWorld* world, const Time& timeStep); // Constructor
|
||||||
virtual ~CollisionEngine(); // Destructor
|
virtual ~CollisionEngine(); // Destructor
|
||||||
|
|
||||||
virtual void update(); // Update the physics simulation
|
virtual void update(); // Update the physics simulation
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
using namespace reactphysics3d;
|
using namespace reactphysics3d;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
DynamicEngine::DynamicEngine(DynamicWorld* world, const Time& timeStep)
|
DynamicEngine::DynamicEngine(PhysicsWorld* world, const Time& timeStep)
|
||||||
:PhysicsEngine(world, timeStep) {
|
:PhysicsEngine(world, timeStep) {
|
||||||
// Check if the pointer to the world is not NULL
|
// Check if the pointer to the world is not NULL
|
||||||
if (world == 0) {
|
if (world == 0) {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "../body/Body.h"
|
#include "../body/Body.h"
|
||||||
#include "../body/RigidBody.h"
|
#include "../body/RigidBody.h"
|
||||||
#include "../body/BodyState.h"
|
#include "../body/BodyState.h"
|
||||||
#include "DynamicWorld.h"
|
#include "PhysicsWorld.h"
|
||||||
#include "../physics/physics.h"
|
#include "../physics/physics.h"
|
||||||
|
|
||||||
// Namespace ReactPhysics3D
|
// 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
|
void updateBodyState(RigidBody* const rigidBody, const Time& timeStep); // Update the state of a rigid body
|
||||||
|
|
||||||
public :
|
public :
|
||||||
DynamicEngine(DynamicWorld* world, const Time& timeStep); // Constructor
|
DynamicEngine(PhysicsWorld* world, const Time& timeStep); // Constructor
|
||||||
DynamicEngine(const DynamicEngine& engine); // Copy-constructor
|
DynamicEngine(const DynamicEngine& engine); // Copy-constructor
|
||||||
virtual ~DynamicEngine(); // Destructor
|
virtual ~DynamicEngine(); // Destructor
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user