mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:23:54 +00:00
set the camera orientation after using teleport doors
This commit is contained in:
parent
2bbbff2b75
commit
36d26e0681
5 changed files with 33 additions and 1 deletions
|
@ -6,4 +6,22 @@ namespace MWRender
|
|||
Player::Player (Ogre::Camera *camera, Ogre::SceneNode* node)
|
||||
: mCamera (camera), mNode (node)
|
||||
{}
|
||||
|
||||
void Player::setRot(float x, float y, float z)
|
||||
{
|
||||
Ogre::SceneNode *sceneNode = mNode;
|
||||
Ogre::Node* yawNode = sceneNode->getChildIterator().getNext();
|
||||
Ogre::Node* pitchNode = yawNode->getChildIterator().getNext();
|
||||
|
||||
// we are only interested in X and Y rotation
|
||||
|
||||
// Rotate around X axis
|
||||
Ogre::Quaternion xr(Ogre::Radian(x), Ogre::Vector3::UNIT_X);
|
||||
|
||||
// Rotate around Y axis
|
||||
Ogre::Quaternion yr(Ogre::Radian(-z), Ogre::Vector3::UNIT_Y);
|
||||
|
||||
pitchNode->setOrientation(xr);
|
||||
yawNode->setOrientation(yr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,9 @@ namespace MWRender
|
|||
|
||||
Ogre::Camera *getCamera() { return mCamera; }
|
||||
|
||||
/// Set where the player is looking at. Uses Morrowind (euler) angles
|
||||
void setRot(float x, float y, float z);
|
||||
|
||||
std::string getHandle() const { return mNode->getName(); }
|
||||
Ogre::SceneNode* getNode() {return mNode;}
|
||||
};
|
||||
|
|
|
@ -40,6 +40,11 @@ namespace MWWorld
|
|||
mWorld.moveObject (getPlayer(), x, y, z);
|
||||
}
|
||||
|
||||
void Player::setRot(float x, float y, float z)
|
||||
{
|
||||
mRenderer->setRot(x, y, z);
|
||||
}
|
||||
|
||||
void Player::setClass (const ESM::Class& class_)
|
||||
{
|
||||
ESM::Class *new_class = new ESM::Class (class_);
|
||||
|
|
|
@ -42,6 +42,9 @@ namespace MWWorld
|
|||
/// Set the player position. Uses Morrowind coordinates.
|
||||
void setPos(float x, float y, float z);
|
||||
|
||||
/// Set where the player is looking at. Uses Morrowind (euler) angles
|
||||
void setRot(float x, float y, float z);
|
||||
|
||||
void setCell (MWWorld::Ptr::CellStore *cellStore)
|
||||
{
|
||||
mCellStore = cellStore;
|
||||
|
|
|
@ -145,10 +145,13 @@ namespace MWWorld
|
|||
bool hasWater = cell->cell->data.flags & cell->cell->HasWater;
|
||||
mPhysics->setCurrentWater(hasWater, cell->cell->water);
|
||||
if (adjustPlayerPos)
|
||||
{
|
||||
mWorld->getPlayer().setPos (position.pos[0], position.pos[1], position.pos[2]);
|
||||
mWorld->getPlayer().setRot (position.rot[0], position.rot[1], position.rot[2]);
|
||||
}
|
||||
|
||||
mWorld->getPlayer().setCell (cell);
|
||||
// TODO orientation
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->addActor (mWorld->getPlayer().getPlayer());
|
||||
MWBase::Environment::get().getMechanicsManager()->watchActor (mWorld->getPlayer().getPlayer());
|
||||
|
||||
|
|
Loading…
Reference in a new issue