diff --git a/sources/reactphysics3d/constraint/Contact.cpp b/sources/reactphysics3d/constraint/Contact.cpp index 1477d5dc..903f47e7 100644 --- a/sources/reactphysics3d/constraint/Contact.cpp +++ b/sources/reactphysics3d/constraint/Contact.cpp @@ -29,6 +29,13 @@ using namespace reactphysics3d; // Constructor Contact::Contact(Body* const body1, Body* const body2, const Vector3D& normal, double penetrationDepth, const Vector3D& point) :Constraint(body1, body2, 2, true), normal(normal), penetrationDepth(penetrationDepth), point(point) { + body1Jacobian.changeSize(1,6); + body2Jacobian.changeSize(1,6); + auxJacobian.changeSize(nbAuxConstraints, 12); + auxLowerBounds.changeSize(nbAuxConstraints); + auxUpperBounds.changeSize(nbAuxConstraints); + auxErrorValues.changeSize(nbAuxConstraints); + body1Jacobian = Matrix(1, 6); body2Jacobian = Matrix(1, 6); auxJacobian = Matrix(nbAuxConstraints, 12); diff --git a/sources/reactphysics3d/engine/PhysicsEngine.cpp b/sources/reactphysics3d/engine/PhysicsEngine.cpp index c87b4682..22445aec 100644 --- a/sources/reactphysics3d/engine/PhysicsEngine.cpp +++ b/sources/reactphysics3d/engine/PhysicsEngine.cpp @@ -86,10 +86,8 @@ void PhysicsEngine::updateCollision() { // While the time accumulator is not empty while(timer.getAccumulator() >= timer.getTimeStep().getValue()) { - // Compute the collision detection if (collisionDetection.computeCollisionDetection()) { - // TODO : Delete this ---------------------------------------------------------- for (std::vector::iterator it = world->getConstraintsBeginIterator(); it != world->getConstraintsEndIterator(); ++it) { RigidBody* rigidBody1 = dynamic_cast((*it)->getBody1()); diff --git a/sources/reactphysics3d/mathematics/Matrix.cpp b/sources/reactphysics3d/mathematics/Matrix.cpp index 61219923..bb0e4938 100644 --- a/sources/reactphysics3d/mathematics/Matrix.cpp +++ b/sources/reactphysics3d/mathematics/Matrix.cpp @@ -27,7 +27,7 @@ using namespace reactphysics3d; // Constructor without argument Matrix::Matrix() :nbRow(0), nbColumn(0) { - + array = 0; } // Constructor of the class Matrix @@ -123,6 +123,28 @@ Matrix::~Matrix() { delete this->array; } +void Matrix::changeSize(uint newNbRows, uint newNbColumns) { + if (array) { + // Destruction of the dynamic array + for(int i=0; iarray; + } + + // Create the two dimensional dynamic array + array = new double*[newNbRows]; + + assert(array != 0); // Array pointer musn't be null + + for(int i=0; i 0); this->maxIterations = maxIterations; }