mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 07:53:51 +00:00
fixed collision toggling bug
This commit is contained in:
parent
c3a492bf74
commit
33ecd8b66c
1 changed files with 23 additions and 18 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "physicssystem.hpp"
|
#include "physicssystem.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/world.hpp" // FIXME
|
#include "../mwworld/world.hpp" // FIXME
|
||||||
|
@ -154,28 +156,31 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
for(std::map<std::string,OEngine::Physic::PhysicActor*>::iterator it = mEngine->PhysicActorMap.begin(); it != mEngine->PhysicActorMap.end();it++)
|
for(std::map<std::string,OEngine::Physic::PhysicActor*>::iterator it = mEngine->PhysicActorMap.begin(); it != mEngine->PhysicActorMap.end();it++)
|
||||||
{
|
{
|
||||||
OEngine::Physic::PhysicActor* act = it->second;
|
if (it->first=="player")
|
||||||
bool cmode = act->getCollisionMode();
|
|
||||||
if(cmode)
|
|
||||||
{
|
{
|
||||||
act->enableCollisions(false);
|
OEngine::Physic::PhysicActor* act = it->second;
|
||||||
act->setGravity(0.);
|
|
||||||
act->setVerticalVelocity(0);
|
bool cmode = act->getCollisionMode();
|
||||||
mFreeFly = true;
|
if(cmode)
|
||||||
return false;
|
{
|
||||||
}
|
act->enableCollisions(false);
|
||||||
else
|
act->setGravity(0.);
|
||||||
{
|
act->setVerticalVelocity(0);
|
||||||
mFreeFly = false;
|
mFreeFly = true;
|
||||||
act->enableCollisions(true);
|
return false;
|
||||||
act->setGravity(4.);
|
}
|
||||||
act->setVerticalVelocity(0);
|
else
|
||||||
return true;
|
{
|
||||||
|
mFreeFly = false;
|
||||||
|
act->enableCollisions(true);
|
||||||
|
act->setGravity(4.);
|
||||||
|
act->setVerticalVelocity(0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false; // This should never happen, but it shall not bother us now, since
|
throw std::logic_error ("can't find player");
|
||||||
// this part of the code needs a rewrite anyway.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue