From e69f2f98fa4ba28dc325a728bf29ad6015768575 Mon Sep 17 00:00:00 2001 From: "chappuis.daniel" Date: Thu, 12 Feb 2009 16:40:17 +0000 Subject: [PATCH] git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@96 92aac97c-a6ce-11dd-a772-7fcde58d38e6 --- .../reactphysics3d/engine/DynamicEngine.cpp | 8 ++-- .../reactphysics3d/engine/DynamicWorld.cpp | 41 +++++++++++++++++++ sources/reactphysics3d/engine/DynamicWorld.h | 4 ++ 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 sources/reactphysics3d/engine/DynamicWorld.cpp diff --git a/sources/reactphysics3d/engine/DynamicEngine.cpp b/sources/reactphysics3d/engine/DynamicEngine.cpp index 73de4e7f..20a13313 100644 --- a/sources/reactphysics3d/engine/DynamicEngine.cpp +++ b/sources/reactphysics3d/engine/DynamicEngine.cpp @@ -56,9 +56,9 @@ void DynamicEngine::update() { while(timer.getAccumulator() >= timer.getTimeStep().getValue()) { // For each body in the dynamic world for(std::vector::const_iterator it = world.getBodyListStartIterator(); it != world.getBodyListEndIterator(); ++it) { - // If the body is a RigidBody + // If the body is a RigidBody and if the rigid body motion is enabled RigidBody* rigidBody = dynamic_cast(*it); - if (rigidBody) { + if (rigidBody && rigidBody->getIsMotionEnabled()) { // Update the state of the rigid body updateBodyState(rigidBody); } @@ -70,9 +70,9 @@ void DynamicEngine::update() { // For each body in the dynamic world for(std::vector::const_iterator it = world.getBodyListStartIterator(); it != world.getBodyListEndIterator(); ++it) { - // If the body is a RigidBody + // If the body is a RigidBody and if the rigid body motion is enabled RigidBody* rigidBody = dynamic_cast(*it); - if (rigidBody) { + if (rigidBody && rigidBody->getIsMotionEnabled()) { // Update the interpolation factor of the rigid body // This one will be used to compute the interpolated state rigidBody->setInterpolationFactor(timer.getInterpolationFactor()); diff --git a/sources/reactphysics3d/engine/DynamicWorld.cpp b/sources/reactphysics3d/engine/DynamicWorld.cpp new file mode 100644 index 00000000..aec63e76 --- /dev/null +++ b/sources/reactphysics3d/engine/DynamicWorld.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +* Copyright (C) 2009 Daniel Chappuis * +**************************************************************************** +* This file is part of ReactPhysics3D. * +* * +* ReactPhysics3D is free software: you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* ReactPhysics3D is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with ReactPhysics3D. If not, see . * +***************************************************************************/ + +// Libraries +#include "DynamicWorld.h" + +// We want to use the ReactPhysics3D namespace +using namespace reactphysics3d; + +// Constructor +DynamicWorld::DynamicWorld(const Vector3D& gravity) + :PhysicsWorld(gravity) { + +} + +// Copy-constructor +DynamicWorld::DynamicWorld(const DynamicWorld& world) + :PhysicsWorld(world) { + +} + +// Destructor +DynamicWorld::~DynamicWorld() { + +} diff --git a/sources/reactphysics3d/engine/DynamicWorld.h b/sources/reactphysics3d/engine/DynamicWorld.h index b44ed1b7..a1b5df41 100644 --- a/sources/reactphysics3d/engine/DynamicWorld.h +++ b/sources/reactphysics3d/engine/DynamicWorld.h @@ -35,6 +35,10 @@ namespace reactphysics3d { */ class DynamicWorld : public PhysicsWorld { + public : + DynamicWorld(const Vector3D& gravity); // Constructor + DynamicWorld(const DynamicWorld& world); // Copy-constructor + virtual ~DynamicWorld(); // Destructor }; }