okay..i think you've got a math problem ;)
you need to know that matrix operations (and quaternion rotations) are not commutative!
the order in which you rotate your model matters! rotX * rotY != rotY * rotX
this means it's not enough to store the 3 angles (not even 3 quaternions for each axis, what is practically the same as a single quaternion with all 3 rotations, too)
your problem is, that the order you need the rotations multiplied together depends on you mental intention how it should behave..
what you can do is keep track of your axis:
save x y z as vector (initialized at startup)
if you want to rotate around one axis, say Y, create an quaternion "form axis rotation" and pass the current saved y axis and the desired angle
use this quaternion to transform all three axis
create your rotation with the current axis as basis.. this can be done e.g. by via Matrix.LookAt (eye = zero, lookat = forwardAxis, up = upAxis)
maybe you need to transpose this afterwards.. (try it)
Show differencesHistory of post edits
#2derKai
Posted 05 September 2012 - 08:01 AM
okay..i think you've got a math problem ;)
you need to know that matrix operations (and quaternion rotations) are not commutative!
the order in which you rotate your model matters! rotX * rotY != rotY * rotX
this means it's not enough to store the 3 angles (not even 3 quaternions for each axis, what is practically the same as a single quaternion with all 3 rotations, too)
your problem is, that the order you need the rotations multiplied together depends on you mental intention how it should behave..
what you can do is keep track of your axis:
save x y z as vector (initialized at startup)
if you want to rotate around one axis, say Y, create an quaternion "form axis rotation" and pass the current saved y axis and the desired angle
use this quaternion to transform all three axis
create your rotation with the current axis as basis.. this can be done e.g. by via Matrix.LookAt (eye = zero, lookat = forwardAxis, up, upAxis)
maybe you need to transpose this afterwards.. (try it)
you need to know that matrix operations (and quaternion rotations) are not commutative!
the order in which you rotate your model matters! rotX * rotY != rotY * rotX
this means it's not enough to store the 3 angles (not even 3 quaternions for each axis, what is practically the same as a single quaternion with all 3 rotations, too)
your problem is, that the order you need the rotations multiplied together depends on you mental intention how it should behave..
what you can do is keep track of your axis:
save x y z as vector (initialized at startup)
if you want to rotate around one axis, say Y, create an quaternion "form axis rotation" and pass the current saved y axis and the desired angle
use this quaternion to transform all three axis
create your rotation with the current axis as basis.. this can be done e.g. by via Matrix.LookAt (eye = zero, lookat = forwardAxis, up, upAxis)
maybe you need to transpose this afterwards.. (try it)
#1derKai
Posted 05 September 2012 - 08:00 AM
okay..i think you've got a math problem ;)
you need to know that matrix operations (and quaternion rotations) are not commutative!
the order in which you rotate your model matters! rotX * rotY != rotY * rotX
this means it's not enough to store the 3 angles (not even 3 quaternions for each axis, what is practically the same as a single quaternion with all 3 rotations, too)
your problem is, that the order you need the rotations multiplied together depends on you mental intention how it should behave..
what you can do is keep track of your axis:
save x y z as vector (initialized at startup)
if you want to rotate around one axis, say Y, create an quaternion "form axis rotation" and pass the current saved axis and the desired angle
use this quaternion to transform all three axis
create your rotation with the current x as basis.. this can be done e.g. by via Matrix.LookAt (eye = zero, lookat = forwardAxis, up, upAxis)
maybe you need to transpose this afterwards.. (try it)
you need to know that matrix operations (and quaternion rotations) are not commutative!
the order in which you rotate your model matters! rotX * rotY != rotY * rotX
this means it's not enough to store the 3 angles (not even 3 quaternions for each axis, what is practically the same as a single quaternion with all 3 rotations, too)
your problem is, that the order you need the rotations multiplied together depends on you mental intention how it should behave..
what you can do is keep track of your axis:
save x y z as vector (initialized at startup)
if you want to rotate around one axis, say Y, create an quaternion "form axis rotation" and pass the current saved axis and the desired angle
use this quaternion to transform all three axis
create your rotation with the current x as basis.. this can be done e.g. by via Matrix.LookAt (eye = zero, lookat = forwardAxis, up, upAxis)
maybe you need to transpose this afterwards.. (try it)