mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 07:53:52 +00:00
Clear out some unneeded doPhysics stuff
This commit is contained in:
parent
3251796ba0
commit
2cdda96798
3 changed files with 0 additions and 104 deletions
|
@ -190,66 +190,8 @@ namespace MWWorld
|
|||
//set the DebugRenderingMode. To disable it,set it to 0
|
||||
//eng->setDebugRenderingMode(1);
|
||||
|
||||
//set the movement keys to 0 (no movement) for every actor)
|
||||
for(std::map<std::string,OEngine::Physic::PhysicActor*>::iterator it = mEngine->PhysicActorMap.begin(); it != mEngine->PhysicActorMap.end();it++)
|
||||
{
|
||||
OEngine::Physic::PhysicActor* act = it->second;
|
||||
act->setMovement(0,0,0);
|
||||
}
|
||||
|
||||
playerMove::playercmd& pm_ref = playerphysics->cmd;
|
||||
|
||||
|
||||
pm_ref.rightmove = 0;
|
||||
pm_ref.forwardmove = 0;
|
||||
pm_ref.upmove = 0;
|
||||
|
||||
|
||||
//playerphysics->ps.move_type = PM_NOCLIP;
|
||||
for (std::vector<std::pair<std::string, Ogre::Vector3> >::const_iterator iter (actors.begin());
|
||||
iter!=actors.end(); ++iter)
|
||||
{
|
||||
//dirty stuff to get the camera orientation. Must be changed!
|
||||
if (iter->first == "player") {
|
||||
playerphysics->ps.viewangles.x =
|
||||
Ogre::Radian(mPlayerData.pitch).valueDegrees();
|
||||
|
||||
|
||||
|
||||
playerphysics->ps.viewangles.y =
|
||||
Ogre::Radian(mPlayerData.yaw).valueDegrees() + 90;
|
||||
|
||||
pm_ref.rightmove = iter->second.x;
|
||||
pm_ref.forwardmove = -iter->second.y;
|
||||
pm_ref.upmove = iter->second.z;
|
||||
}
|
||||
}
|
||||
mEngine->stepSimulation(dt);
|
||||
}
|
||||
|
||||
std::vector< std::pair<std::string, Ogre::Vector3> > PhysicsSystem::doPhysicsFixed (
|
||||
const std::vector<std::pair<std::string, Ogre::Vector3> >& actors)
|
||||
{
|
||||
Pmove(playerphysics);
|
||||
|
||||
|
||||
std::vector< std::pair<std::string, Ogre::Vector3> > response;
|
||||
for(std::map<std::string,OEngine::Physic::PhysicActor*>::iterator it = mEngine->PhysicActorMap.begin(); it != mEngine->PhysicActorMap.end();it++)
|
||||
{
|
||||
|
||||
Ogre::Vector3 coord = it->second->getPosition();
|
||||
if(it->first == "player"){
|
||||
|
||||
coord = playerphysics->ps.origin ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
response.push_back(std::pair<std::string, Ogre::Vector3>(it->first, coord));
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
void PhysicsSystem::addHeightField (float* heights,
|
||||
int x, int y, float yoffset,
|
||||
|
|
|
@ -17,9 +17,6 @@ namespace MWWorld
|
|||
void doPhysics(float duration, const std::vector<std::pair<std::string, Ogre::Vector3> >& actors);
|
||||
///< do physics with dt - Usage: first call doPhysics with frame dt, then call doPhysicsFixed as often as time steps have passed
|
||||
|
||||
std::vector< std::pair<std::string, Ogre::Vector3> > doPhysicsFixed (const std::vector<std::pair<std::string, Ogre::Vector3> >& actors);
|
||||
///< do physics with fixed timestep - Usage: first call doPhysics with frame dt, then call doPhysicsFixed as often as time steps have passed
|
||||
|
||||
void addObject (const MWWorld::Ptr& ptr);
|
||||
|
||||
void addActor (const MWWorld::Ptr& ptr);
|
||||
|
|
|
@ -838,49 +838,6 @@ namespace MWWorld
|
|||
float duration)
|
||||
{
|
||||
mPhysics->doPhysics(duration, actors);
|
||||
|
||||
const int tick = 16; // 16 ms ^= 60 Hz
|
||||
|
||||
// Game clock part of the loop, contains everything that has to be executed in a fixed timestep
|
||||
long long dt = mTimer.getMilliseconds() - lastTick;
|
||||
if (dt >= 100)
|
||||
{
|
||||
// throw away wall clock time if necessary to keep the framerate above the minimum of 10 fps
|
||||
lastTick += (dt - 100);
|
||||
dt = 100;
|
||||
}
|
||||
while (dt >= tick)
|
||||
{
|
||||
dt -= tick;
|
||||
lastTick += tick;
|
||||
|
||||
std::vector< std::pair<std::string, Ogre::Vector3> > vectors = mPhysics->doPhysicsFixed (actors);
|
||||
|
||||
std::vector< std::pair<std::string, Ogre::Vector3> >::iterator player = vectors.end();
|
||||
|
||||
for (std::vector< std::pair<std::string, Ogre::Vector3> >::iterator it = vectors.begin();
|
||||
it!= vectors.end(); ++it)
|
||||
{
|
||||
if (it->first=="player")
|
||||
{
|
||||
player = it;
|
||||
}
|
||||
else
|
||||
{
|
||||
MWWorld::Ptr ptr = getPtrViaHandle (it->first);
|
||||
moveObjectImp (ptr, it->second.x, it->second.y, it->second.z);
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure player is moved last (otherwise the cell might change in the middle of an update
|
||||
// loop)
|
||||
if (player!=vectors.end())
|
||||
{
|
||||
if (moveObjectImp (getPtrViaHandle (player->first),
|
||||
player->second.x, player->second.y, player->second.z) == true)
|
||||
return; // abort the current loop if the cell has changed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool World::toggleCollisionMode()
|
||||
|
|
Loading…
Reference in a new issue