diff --git a/examples/cubes/Scene.cpp b/examples/cubes/Scene.cpp index 240dd757..a794e713 100644 --- a/examples/cubes/Scene.cpp +++ b/examples/cubes/Scene.cpp @@ -132,7 +132,7 @@ void Scene::simulate() { if (mIsRunning) { counter++; - if (counter == 800) mIsRunning = false; + if (counter == 1000) mIsRunning = false; // Take a simulation step mDynamicsWorld->update(); diff --git a/src/body/RigidBody.cpp b/src/body/RigidBody.cpp index 8ba46008..224adcee 100644 --- a/src/body/RigidBody.cpp +++ b/src/body/RigidBody.cpp @@ -298,6 +298,8 @@ void RigidBody::recomputeMassInformation() { // Update the broad-phase state for this body (because it has moved for instance) void RigidBody::updateBroadPhaseState() const { + PROFILE("RigidBody::updateBroadPhaseState()"); + DynamicsWorld& world = dynamic_cast(mWorld); const Vector3 displacement = world.mTimer.getTimeStep() * mLinearVelocity; diff --git a/src/collision/CollisionDetection.h b/src/collision/CollisionDetection.h index b405ec12..ded6ae4b 100644 --- a/src/collision/CollisionDetection.h +++ b/src/collision/CollisionDetection.h @@ -147,7 +147,6 @@ class CollisionDetection { // -------------------- Friendship -------------------- // - // TODO : REMOVE THIS friend class DynamicsWorld; }; diff --git a/src/collision/shapes/CollisionShape.cpp b/src/collision/shapes/CollisionShape.cpp index f7de614f..89292370 100644 --- a/src/collision/shapes/CollisionShape.cpp +++ b/src/collision/shapes/CollisionShape.cpp @@ -25,6 +25,7 @@ // Libraries #include "CollisionShape.h" +#include "../../engine/Profiler.h" // We want to use the ReactPhysics3D namespace using namespace reactphysics3d; @@ -50,6 +51,8 @@ CollisionShape::~CollisionShape() { // Compute the world-space AABB of the collision shape given a transform void CollisionShape::computeAABB(AABB& aabb, const Transform& transform) const { + PROFILE("CollisionShape::computeAABB()"); + // Get the local bounds in x,y and z direction Vector3 minBounds; Vector3 maxBounds; diff --git a/src/configuration.h b/src/configuration.h index 6cb26b4c..5a024e9c 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -129,7 +129,7 @@ const decimal DYNAMIC_TREE_AABB_GAP = decimal(0.1); /// In the broad-phase collision detection (dynamic AABB tree), the AABBs are /// also inflated in direction of the linear motion of the body by mutliplying the /// followin constant with the linear velocity and the elapsed time between two frames. -const decimal DYNAMIC_TREE_AABB_LIN_GAP_MULTIPLIER = decimal(2.0); +const decimal DYNAMIC_TREE_AABB_LIN_GAP_MULTIPLIER = decimal(1.7); } diff --git a/src/engine/DynamicsWorld.cpp b/src/engine/DynamicsWorld.cpp index 3f9888aa..284197e5 100644 --- a/src/engine/DynamicsWorld.cpp +++ b/src/engine/DynamicsWorld.cpp @@ -219,10 +219,6 @@ void DynamicsWorld::updateBodiesState() { uint index = mMapBodyToConstrainedVelocityIndex.find(bodies[b])->second; - // TODO : Delete this - Vector3 linVel = mConstrainedLinearVelocities[index]; - Vector3 angVel = mConstrainedAngularVelocities[index]; - // Update the linear and angular velocity of the body bodies[b]->mLinearVelocity = mConstrainedLinearVelocities[index]; bodies[b]->mAngularVelocity = mConstrainedAngularVelocities[index]; @@ -230,9 +226,6 @@ void DynamicsWorld::updateBodiesState() { // Update the position of the center of mass of the body bodies[b]->mCenterOfMassWorld = mConstrainedPositions[index]; - // TODO : DELETE THIS - Quaternion newOrient = mConstrainedOrientations[index]; - // Update the orientation of the body bodies[b]->mTransform.setOrientation(mConstrainedOrientations[index].getUnit());