1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-01 02:45:32 +00:00

Merge remote branch 'gus/collision' into collision

This commit is contained in:
Marc Zinnschlag 2011-03-22 20:20:49 +01:00
commit 9946bb36f7
2 changed files with 10 additions and 5 deletions

View file

@ -109,13 +109,13 @@ void MWScene::doPhysics (float duration, MWWorld::World& world,
Ogre::Quaternion yawQuat = yawNode->getOrientation(); Ogre::Quaternion yawQuat = yawNode->getOrientation();
Ogre::Quaternion pitchQuat = pitchNode->getOrientation(); Ogre::Quaternion pitchQuat = pitchNode->getOrientation();
Ogre::Vector3 dir1(iter->second.x,iter->second.z,-iter->second.y); Ogre::Vector3 dir1(iter->second.x,iter->second.z,-iter->second.y);
dir = 0.01*(yawQuat*pitchQuat*dir1); dir = 0.07*(yawQuat*pitchQuat*dir1);
} }
else else
{ {
Ogre::Quaternion quat = yawNode->getOrientation(); Ogre::Quaternion quat = yawNode->getOrientation();
Ogre::Vector3 dir1(iter->second.x,iter->second.z,-iter->second.y); Ogre::Vector3 dir1(iter->second.x,iter->second.z,-iter->second.y);
dir = 0.01*(quat*dir1); dir = 0.07*(quat*dir1);
} }
//set the walk direction //set the walk direction
@ -163,7 +163,7 @@ void MWScene::moveObject (const std::string& handle, const Ogre::Vector3& positi
{ {
rend.getScene()->getSceneNode(handle)->setPosition(position); rend.getScene()->getSceneNode(handle)->setPosition(position);
if(updatePhysics)//TODO: is it an actor? if(updatePhysics)//TODO: is it an actor? Done?
{ {
if (OEngine::Physic::RigidBody* body = eng->getRigidBody(handle)) if (OEngine::Physic::RigidBody* body = eng->getRigidBody(handle))
{ {
@ -173,6 +173,12 @@ void MWScene::moveObject (const std::string& handle, const Ogre::Vector3& positi
tr.setOrigin(btVector3(position.x,position.y,position.z)); tr.setOrigin(btVector3(position.x,position.y,position.z));
body->setWorldTransform(tr); body->setWorldTransform(tr);
} }
if (OEngine::Physic::PhysicActor* act = eng->getCharacter(handle))
{
// TODO very dirty hack to avoid crash during setup -> needs cleaning up to allow
// start positions others than 0, 0, 0
act->setPosition(btVector3(position.x,position.y,position.z));
}
} }
} }

View file

@ -309,11 +309,10 @@ namespace MWWorld
bool adjustPlayerPos) bool adjustPlayerPos)
{ {
if (adjustPlayerPos) if (adjustPlayerPos)
mPlayer->setPos (position.pos[0], position.pos[1], position.pos[2], true); mPlayer->setPos (position.pos[0], position.pos[1], position.pos[2], false);
mPlayer->setCell (cell); mPlayer->setCell (cell);
// TODO orientation // TODO orientation
mEnvironment.mMechanicsManager->addActor (mPlayer->getPlayer()); mEnvironment.mMechanicsManager->addActor (mPlayer->getPlayer());
mEnvironment.mMechanicsManager->watchActor (mPlayer->getPlayer()); mEnvironment.mMechanicsManager->watchActor (mPlayer->getPlayer());
} }