Code: Select all
core::vector3df CameraPos;
CameraPos = this->getAbsolutePosition();
nRotX = (MousePos.X) * -1.0f;
nRotY = (MousePos.Y) * -1.0f;
// Rotates around Y
Target.rotateYZBy(-nRotY, CameraPos);
// Rotates around X
Target.rotateXZBy(nRotX, CameraPos);
Code: Select all
UpVector.rotateYZBy(-nRotY, core::vector3df(0,0,0));
UpVector.rotateXZBy(nRotX,, core::vector3df(0,0,0));
UpVector.normalize();
Does anyone know how to correctly rotate the UpVector for my implementation?
This code is in the Maya sceneNode class but looks kinda nasty:
Code: Select all
if (nRotY >= 90.0f && nRotY <= 270.0f)
UpVector.set(0, -1, 0);
else
UpVector.set(0, 1, 0);
Also I've notice that with my code my target (target object added using 'addTestSceneNode' without a rotation value specified) not only rotates around the camera's origin but also rotates around its own Axis, is this just an Engine bug or am I doing something silly?
ThanX