2011-01-08 15:11:37 +01:00
|
|
|
|
|
|
|
#include "player.hpp"
|
|
|
|
|
|
|
|
namespace MWRender
|
|
|
|
{
|
2011-11-16 21:15:49 -05:00
|
|
|
Player::Player (Ogre::Camera *camera, Ogre::SceneNode* node)
|
|
|
|
: mCamera (camera), mNode (node)
|
2011-01-08 15:11:37 +01:00
|
|
|
{}
|
2012-05-30 15:52:39 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2011-01-08 15:11:37 +01:00
|
|
|
}
|