From 40d772b33a2747b88f1644c7454a81cfb3718a3e Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 29 Jan 2011 17:39:34 +0100 Subject: [PATCH] call doPhysics function once per frame --- apps/openmw/engine.cpp | 2 ++ apps/openmw/mwworld/world.cpp | 5 +++++ apps/openmw/mwworld/world.hpp | 3 +++ 3 files changed, 10 insertions(+) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 3eaff2fe14..2f0d52772f 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -179,6 +179,8 @@ bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt) focusFrameCounter = 0; } + + mEnvironment.mWorld->doPhysics (mEnvironment.mFrameDuration); } catch (const std::exception& e) { diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/world.cpp index 9ec5ea52c9..38e553286d 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/world.cpp @@ -833,4 +833,9 @@ namespace MWWorld if (y<0) --cellY; } + + void World::doPhysics (float duration) + { + mScene.doPhysics (duration, *this); + } } diff --git a/apps/openmw/mwworld/world.hpp b/apps/openmw/mwworld/world.hpp index ce66a63d7e..e44bdf27c6 100644 --- a/apps/openmw/mwworld/world.hpp +++ b/apps/openmw/mwworld/world.hpp @@ -162,6 +162,9 @@ namespace MWWorld void positionToIndex (float x, float y, int &cellX, int &cellY) const; ///< Convert position to cell numbers + + void doPhysics (float duration); + ///< Run physics simulation and modify \a world accordingly. }; }