forked from mirror/openmw-tes3mp
Remove the unneeded playerMove object from PhysicsSystem
This commit is contained in:
parent
8de2d24d0e
commit
fe0e6c452d
4 changed files with 27 additions and 31 deletions
|
@ -9,8 +9,9 @@
|
|||
#include <OgreCamera.h>
|
||||
#include <OgreTextureManager.h>
|
||||
|
||||
#include <libs/openengine/bullet/trace.h>
|
||||
#include <libs/openengine/bullet/physic.hpp>
|
||||
#include <openengine/bullet/trace.h>
|
||||
#include <openengine/bullet/physic.hpp>
|
||||
#include <openengine/ogre/renderer.hpp>
|
||||
|
||||
#include <components/nifbullet/bullet_nif_loader.hpp>
|
||||
|
||||
|
@ -25,6 +26,7 @@ namespace MWWorld
|
|||
{
|
||||
|
||||
static const float sMaxSlope = 60.0f;
|
||||
static const float sStepSize = 9.0f;
|
||||
|
||||
class MovementSolver
|
||||
{
|
||||
|
@ -35,13 +37,13 @@ namespace MWWorld
|
|||
{
|
||||
traceResults trace; // no initialization needed
|
||||
|
||||
newtrace(&trace, position+Ogre::Vector3(0.0f,0.0f,STEPSIZE),
|
||||
position+Ogre::Vector3(0.0f,0.0f,STEPSIZE)+velocity*remainingTime,
|
||||
newtrace(&trace, position+Ogre::Vector3(0.0f,0.0f,sStepSize),
|
||||
position+Ogre::Vector3(0.0f,0.0f,sStepSize)+velocity*remainingTime,
|
||||
halfExtents, verticalRotation, isInterior, engine);
|
||||
if(trace.fraction == 0.0f || (trace.fraction != 1.0f && getSlope(trace.planenormal) > sMaxSlope))
|
||||
return false;
|
||||
|
||||
newtrace(&trace, trace.endpos, trace.endpos-Ogre::Vector3(0,0,STEPSIZE), halfExtents, verticalRotation, isInterior, engine);
|
||||
newtrace(&trace, trace.endpos, trace.endpos-Ogre::Vector3(0.0f,0.0f,sStepSize), halfExtents, verticalRotation, isInterior, engine);
|
||||
if(getSlope(trace.planenormal) < sMaxSlope)
|
||||
{
|
||||
// only step down onto semi-horizontal surfaces. don't step down onto the side of a house or a wall.
|
||||
|
@ -197,20 +199,16 @@ namespace MWWorld
|
|||
PhysicsSystem::PhysicsSystem(OEngine::Render::OgreRenderer &_rend) :
|
||||
mRender(_rend), mEngine(0), mFreeFly (true)
|
||||
{
|
||||
|
||||
playerphysics = new playerMove;
|
||||
// Create physics. shapeLoader is deleted by the physic engine
|
||||
NifBullet::ManualBulletShapeLoader* shapeLoader = new NifBullet::ManualBulletShapeLoader();
|
||||
mEngine = new OEngine::Physic::PhysicEngine(shapeLoader);
|
||||
playerphysics->mEngine = mEngine;
|
||||
}
|
||||
|
||||
PhysicsSystem::~PhysicsSystem()
|
||||
{
|
||||
delete mEngine;
|
||||
delete playerphysics;
|
||||
|
||||
}
|
||||
|
||||
OEngine::Physic::PhysicEngine* PhysicsSystem::getEngine()
|
||||
{
|
||||
return mEngine;
|
||||
|
@ -279,15 +277,8 @@ namespace MWWorld
|
|||
|
||||
void PhysicsSystem::setCurrentWater(bool hasWater, int waterHeight)
|
||||
{
|
||||
playerphysics->hasWater = hasWater;
|
||||
if(hasWater){
|
||||
playerphysics->waterHeight = waterHeight;
|
||||
}
|
||||
for(std::map<std::string,OEngine::Physic::PhysicActor*>::iterator it = mEngine->PhysicActorMap.begin(); it != mEngine->PhysicActorMap.end();it++)
|
||||
{
|
||||
it->second->setCurrentWater(hasWater, waterHeight);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
btVector3 PhysicsSystem::getRayPoint(float extent)
|
||||
|
@ -428,14 +419,8 @@ namespace MWWorld
|
|||
{
|
||||
// TODO very dirty hack to avoid crash during setup -> needs cleaning up to allow
|
||||
// start positions others than 0, 0, 0
|
||||
if (handle == "player")
|
||||
{
|
||||
playerphysics->ps.origin = position;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (handle != "player")
|
||||
act->setPosition(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -474,7 +459,6 @@ namespace MWWorld
|
|||
|
||||
bool PhysicsSystem::toggleCollisionMode()
|
||||
{
|
||||
playerphysics->ps.move_type = (playerphysics->ps.move_type == PM_NOCLIP ? PM_NORMAL : PM_NOCLIP);
|
||||
for(std::map<std::string,OEngine::Physic::PhysicActor*>::iterator it = mEngine->PhysicActorMap.begin(); it != mEngine->PhysicActorMap.end();it++)
|
||||
{
|
||||
if (it->first=="player")
|
||||
|
|
|
@ -1,15 +1,27 @@
|
|||
#ifndef GAME_MWWORLD_PHYSICSSYSTEM_H
|
||||
#define GAME_MWWORLD_PHYSICSSYSTEM_H
|
||||
|
||||
#include <OgreVector3.h>
|
||||
|
||||
#include <btBulletCollisionCommon.h>
|
||||
|
||||
#include <openengine/ogre/renderer.hpp>
|
||||
#include <openengine/bullet/pmove.h>
|
||||
#include "ptr.hpp"
|
||||
|
||||
namespace OEngine
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
class OgreRenderer;
|
||||
}
|
||||
namespace Physic
|
||||
{
|
||||
class PhysicEngine;
|
||||
}
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class World;
|
||||
class Ptr;
|
||||
|
||||
class PhysicsSystem
|
||||
{
|
||||
|
@ -74,7 +86,6 @@ namespace MWWorld
|
|||
OEngine::Render::OgreRenderer &mRender;
|
||||
OEngine::Physic::PhysicEngine* mEngine;
|
||||
bool mFreeFly;
|
||||
playerMove* playerphysics;
|
||||
std::map<std::string, std::string> handleToMesh;
|
||||
|
||||
PhysicsSystem (const PhysicsSystem&);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "physicssystem.hpp"
|
||||
#include "player.hpp"
|
||||
#include "localscripts.hpp"
|
||||
#include "esmstore.hpp"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../mwrender/renderingmanager.hpp"
|
||||
|
||||
#include "physicssystem.hpp"
|
||||
#include "ptr.hpp"
|
||||
#include "globals.hpp"
|
||||
|
||||
namespace Ogre
|
||||
|
@ -34,9 +34,9 @@ namespace MWRender
|
|||
|
||||
namespace MWWorld
|
||||
{
|
||||
class PhysicsSystem;
|
||||
class Player;
|
||||
class CellStore;
|
||||
class Ptr;
|
||||
|
||||
class Scene
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue