2013-02-04 07:10:14 -08:00
|
|
|
#ifndef GAME_MWMECHANICS_MOVEMENTSOLVER_H
|
|
|
|
#define GAME_MWMECHANICS_MOVEMENTSOLVER_H
|
|
|
|
|
2013-02-04 11:17:48 -08:00
|
|
|
#include <OgreVector3.h>
|
2013-02-04 07:10:14 -08:00
|
|
|
|
2013-02-04 11:17:48 -08:00
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
class Ptr;
|
|
|
|
}
|
2013-02-04 07:10:14 -08:00
|
|
|
|
2013-02-04 11:17:48 -08:00
|
|
|
namespace OEngine
|
|
|
|
{
|
|
|
|
namespace Physic
|
|
|
|
{
|
|
|
|
class PhysicEngine;
|
|
|
|
class PhysicActor;
|
|
|
|
}
|
|
|
|
}
|
2013-02-04 07:10:14 -08:00
|
|
|
|
|
|
|
namespace MWMechanics
|
|
|
|
{
|
|
|
|
class MovementSolver
|
|
|
|
{
|
|
|
|
public:
|
2013-02-04 11:17:48 -08:00
|
|
|
MovementSolver();
|
2013-02-04 07:10:14 -08:00
|
|
|
virtual ~MovementSolver();
|
|
|
|
|
2013-02-04 11:17:48 -08:00
|
|
|
Ogre::Vector3 move(const MWWorld::Ptr &ptr, const Ogre::Vector3 &movement, float time, const Ogre::Vector3 &halfExtents);
|
2013-02-04 07:10:14 -08:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool stepMove(Ogre::Vector3& position, const Ogre::Vector3 &velocity, float remainingTime, float verticalRotation, const Ogre::Vector3 &halfExtents, bool isInterior);
|
|
|
|
|
|
|
|
void clipVelocity(const Ogre::Vector3& in, const Ogre::Vector3& normal, Ogre::Vector3& out, const float overbounce);
|
|
|
|
void projectVelocity(Ogre::Vector3& velocity, const Ogre::Vector3& direction);
|
|
|
|
|
|
|
|
float getSlope(const Ogre::Vector3 &normal);
|
|
|
|
|
|
|
|
OEngine::Physic::PhysicEngine *mEngine;
|
|
|
|
OEngine::Physic::PhysicActor *mPhysicActor;
|
|
|
|
|
|
|
|
float verticalVelocity;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* GAME_MWMECHANICS_MOVEMENTSOLVER_H */
|