This commit is contained in:
Daniel Chappuis 2014-07-22 22:46:24 +02:00
commit 0faacdbd6b
6 changed files with 7 additions and 10 deletions

View File

@ -132,7 +132,7 @@ void Scene::simulate() {
if (mIsRunning) { if (mIsRunning) {
counter++; counter++;
if (counter == 800) mIsRunning = false; if (counter == 1000) mIsRunning = false;
// Take a simulation step // Take a simulation step
mDynamicsWorld->update(); mDynamicsWorld->update();

View File

@ -298,6 +298,8 @@ void RigidBody::recomputeMassInformation() {
// Update the broad-phase state for this body (because it has moved for instance) // Update the broad-phase state for this body (because it has moved for instance)
void RigidBody::updateBroadPhaseState() const { void RigidBody::updateBroadPhaseState() const {
PROFILE("RigidBody::updateBroadPhaseState()");
DynamicsWorld& world = dynamic_cast<DynamicsWorld&>(mWorld); DynamicsWorld& world = dynamic_cast<DynamicsWorld&>(mWorld);
const Vector3 displacement = world.mTimer.getTimeStep() * mLinearVelocity; const Vector3 displacement = world.mTimer.getTimeStep() * mLinearVelocity;

View File

@ -147,7 +147,6 @@ class CollisionDetection {
// -------------------- Friendship -------------------- // // -------------------- Friendship -------------------- //
// TODO : REMOVE THIS
friend class DynamicsWorld; friend class DynamicsWorld;
}; };

View File

@ -25,6 +25,7 @@
// Libraries // Libraries
#include "CollisionShape.h" #include "CollisionShape.h"
#include "../../engine/Profiler.h"
// We want to use the ReactPhysics3D namespace // We want to use the ReactPhysics3D namespace
using namespace reactphysics3d; using namespace reactphysics3d;
@ -50,6 +51,8 @@ CollisionShape::~CollisionShape() {
// Compute the world-space AABB of the collision shape given a transform // Compute the world-space AABB of the collision shape given a transform
void CollisionShape::computeAABB(AABB& aabb, const Transform& transform) const { void CollisionShape::computeAABB(AABB& aabb, const Transform& transform) const {
PROFILE("CollisionShape::computeAABB()");
// Get the local bounds in x,y and z direction // Get the local bounds in x,y and z direction
Vector3 minBounds; Vector3 minBounds;
Vector3 maxBounds; Vector3 maxBounds;

View File

@ -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 /// 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 /// 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. /// 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);
} }

View File

@ -219,10 +219,6 @@ void DynamicsWorld::updateBodiesState() {
uint index = mMapBodyToConstrainedVelocityIndex.find(bodies[b])->second; 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 // Update the linear and angular velocity of the body
bodies[b]->mLinearVelocity = mConstrainedLinearVelocities[index]; bodies[b]->mLinearVelocity = mConstrainedLinearVelocities[index];
bodies[b]->mAngularVelocity = mConstrainedAngularVelocities[index]; bodies[b]->mAngularVelocity = mConstrainedAngularVelocities[index];
@ -230,9 +226,6 @@ void DynamicsWorld::updateBodiesState() {
// Update the position of the center of mass of the body // Update the position of the center of mass of the body
bodies[b]->mCenterOfMassWorld = mConstrainedPositions[index]; bodies[b]->mCenterOfMassWorld = mConstrainedPositions[index];
// TODO : DELETE THIS
Quaternion newOrient = mConstrainedOrientations[index];
// Update the orientation of the body // Update the orientation of the body
bodies[b]->mTransform.setOrientation(mConstrainedOrientations[index].getUnit()); bodies[b]->mTransform.setOrientation(mConstrainedOrientations[index].getUnit());