quaternion camera rotation question

Started by
12 comments, last by iradel 18 years, 5 months ago
I think I see the problem, the hud model is rotating around it's own local axes...which only works when the global camera is very close to its default orientation. If you move the camera around, it messes up. Now to figure out a solution... :)
Advertisement
Lets say I was doing a split-screen or a multiplayer game, something where there are 2 ships flying around in space. Ship 1 is looking at ship 2. Meanwhile, Ship 2 is moving his mouse around and rotating around in the world. I know what his camera quat/matrix is (from his point of view). Looking at him from ship 1, what rotation do I need to apply when drawing ship 2 so that he is oriented correctly from ship 1's perspective?
Quote:Lets say I was doing a split-screen or a multiplayer game, something where there are 2 ships flying around in space. Ship 1 is looking at ship 2. Meanwhile, Ship 2 is moving his mouse around and rotating around in the world. I know what his camera quat/matrix is (from his point of view). Looking at him from ship 1, what rotation do I need to apply when drawing ship 2 so that he is oriented correctly from ship 1's perspective?
Well, I'm not sure if I follow, but here's a guess. If A is ship 1's rotation and B is ship 2's rotation, you want to find a rotation C that represents B in A's space. This should be:
Quaternion C = A.Conjugate()*B;
Anyway, you might try that and see if it gives you the results you're looking for.
That works. Thank you very much! I wish I knew quaternion math better rather than fumbling my way through it. But this is the first time I'm having to deal with gimbal lock in a game/project.

This topic is closed to new replies.

Advertisement