Hi again,
I'm trying to figure out how to rotate an object relative to the X Y axis of the screen space.
This *seemed* at first to almost work, but when I move the camera behind or under the object, I get inverse and / or reverse rotations - so I guess I'm way off here. :-(
Any suggestions?
Thank you,
S.
public SimpleVector rotateRespect2Cam(float rotX, float rotY)
{
SimpleVector dir = theCamera.getDirection();
dir.rotateX(rotX);
dir.rotateY(rotY);
return dir.calcSub(theCamera.getDirection());
}
SimpleVector rotate = rotateRespect2Cam(delta.x * -camRotSpeed, delta.y * -camRotSpeed);
object.rotateX(rotate.x); // rx rz ry to avoid gimbal lock.
object.rotateZ(rotate.z);
object.rotateY(rotate.y);