forked from teamnwah/openmw-tes3coop
general player class cleanup
This commit is contained in:
parent
4a12be11bf
commit
4f51391003
2 changed files with 44 additions and 44 deletions
|
@ -32,6 +32,27 @@ namespace MWWorld
|
|||
-mPlayer.ref.pos.pos[1]));
|
||||
}
|
||||
|
||||
void Player::moveRel (float &relX, float &relY, float &relZ)
|
||||
{
|
||||
// Move camera relative to its own direction
|
||||
camera->moveRelative (Ogre::Vector3(relX,0,relZ));
|
||||
|
||||
// Up/down movement is always done relative the world axis.
|
||||
camera->move (Ogre::Vector3(0,relY,0));
|
||||
|
||||
// Get new camera position, converting back to MW coords.
|
||||
Ogre::Vector3 pos = camera->getPosition();
|
||||
relX = pos[0];
|
||||
relY = -pos[2];
|
||||
relZ = pos[1];
|
||||
|
||||
// TODO: Collision detection must be used to find the REAL new
|
||||
// position.
|
||||
|
||||
// Set the position
|
||||
setPos(relX, relY, relZ);
|
||||
}
|
||||
|
||||
void Player::setClass (const ESM::Class& class_)
|
||||
{
|
||||
ESM::Class *new_class = new ESM::Class (class_);
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace MWWorld
|
|||
|
||||
~Player();
|
||||
|
||||
// Set the player position. Uses Morrowind coordinates.
|
||||
/// Set the player position. Uses Morrowind coordinates.
|
||||
void setPos(float _x, float _y, float _z, bool updateCamera = false);
|
||||
|
||||
void setCell (MWWorld::Ptr::CellStore *cellStore)
|
||||
|
@ -43,30 +43,9 @@ namespace MWWorld
|
|||
|
||||
Ogre::Camera *getCamera() { return camera; }
|
||||
|
||||
// Move the player relative to her own position and
|
||||
// orientation. After the call, the new position is returned.
|
||||
void moveRel(float &relX, float &relY, float &relZ)
|
||||
{
|
||||
using namespace Ogre;
|
||||
|
||||
// Move camera relative to its own direction
|
||||
camera->moveRelative(Vector3(relX,0,relZ));
|
||||
|
||||
// Up/down movement is always done relative the world axis.
|
||||
camera->move(Vector3(0,relY,0));
|
||||
|
||||
// Get new camera position, converting back to MW coords.
|
||||
Vector3 pos = camera->getPosition();
|
||||
relX = pos[0];
|
||||
relY = -pos[2];
|
||||
relZ = pos[1];
|
||||
|
||||
// TODO: Collision detection must be used to find the REAL new
|
||||
// position.
|
||||
|
||||
// Set the position
|
||||
setPos(relX, relY, relZ);
|
||||
}
|
||||
/// Move the player relative to her own position and
|
||||
/// orientation. After the call, the new position is returned.
|
||||
void moveRel (float &relX, float &relY, float &relZ);
|
||||
|
||||
MWWorld::Ptr getPlayer()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue