From 7b5d24c853f09e824952e1aba14ab3a249a4d5d1 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Tue, 22 Mar 2011 13:48:31 +0100 Subject: [PATCH] fixed a bug in phyiscs update code --- apps/openmw/mwrender/mwscene.cpp | 18 +++++++++++------- apps/openmw/mwworld/doingphysics.cpp | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwrender/mwscene.cpp b/apps/openmw/mwrender/mwscene.cpp index 5edadda97..e7ae53851 100644 --- a/apps/openmw/mwrender/mwscene.cpp +++ b/apps/openmw/mwrender/mwscene.cpp @@ -163,13 +163,17 @@ void MWScene::moveObject (const std::string& handle, const Ogre::Vector3& positi { rend.getScene()->getSceneNode(handle)->setPosition(position); - if(updatePhysics)//TODO: is it an actor? - { - OEngine::Physic::RigidBody* body = eng->getRigidBody(handle); - btTransform tr = body->getWorldTransform(); - tr.setOrigin(btVector3(position.x,position.y,position.z)); - body->setWorldTransform(tr); - } + if(updatePhysics)//TODO: is it an actor? + { + if (OEngine::Physic::RigidBody* body = eng->getRigidBody(handle)) + { + // TODO very dirty hack to avoid crash during setup -> needs cleaning up to allow + // start positions others than 0, 0, 0 + btTransform tr = body->getWorldTransform(); + tr.setOrigin(btVector3(position.x,position.y,position.z)); + body->setWorldTransform(tr); + } + } } void MWScene::rotateObject (const std::string& handle, const Ogre::Quaternion& rotation) diff --git a/apps/openmw/mwworld/doingphysics.cpp b/apps/openmw/mwworld/doingphysics.cpp index 27fb27c57..84fb4e2ab 100644 --- a/apps/openmw/mwworld/doingphysics.cpp +++ b/apps/openmw/mwworld/doingphysics.cpp @@ -18,7 +18,7 @@ namespace MWWorld bool DoingPhysics::isDoingPhysics() { - return sCounter>0 || sSuppress>0; + return sCounter>0 && sSuppress==0; } SuppressDoingPhysics::SuppressDoingPhysics()