3d world euler rotation

forget it, "solved" - i realised i was trying to rotate angles and that the more complex methods are justified.




i'm sure everybody knows this is a problem, but i'm hoping someone has experience with exactly how it is a problem so i can fix it :)

[img]http://xoxos.net/temp/rotation_error.jpg[/img]
http://xoxos.net/temp/rotation_error.jpg if not displayed
if not visible:
frame 1: stating at one side of a tetrahedron
frame 2: viewer has turned left, tetrahedron is to right
frame 3: viewer has rolled to left, tetrahedron is at lower right of frustrum view
frame 4: turning left or right moves tetrahedron diagonally across screen instead of to left or right


the consensus is that quaternions are preferable for game space rotations, but i am not convinced that the problem lies outside of my conception of procedure, so that switching to quaternions wouldn't effectively fix anything...

my game loop runs as such:

1
2
3
4
5
6
7
8
loc place0;    // camera location - loc class contains a few movement pertinent vectors
loc place1;    // location of tetrahedron, set to (0,0,2)
// loop
tetra shape1 = shape0;  // create real instance of ideal state object
shape1 += place1.position;	// move tetrahedron shape1 to it's location
shape1.rotate(place0.rotation);  // rotate game world objects to viewers
place0.rotation += place0.w;   // adjust player rotation by angular momentum
//process player input to adjust place0.w 



the problem is understandably produced in a naive "player input" process by eg. taking left/right instructions as rotations around the y axis.. when the player rolls, the y axis is obviously not aligned to the current facing/"upwards" orientation.


so, i've tried a number of methods to rotate the movement player input into the current rotation, but none of them have given me much insight :) an earlier problem of gimbal lock was solved by introducing an intermediate state variable.. i've tried a few things like that, like

replace this:
place0.rotation += place0.w;

with something like this:
point3 temp = place0.w;
temp.rotate(place0.rotation);
place0.rotation += temp;

and a few other things, but i'm really just hacking at it as i have been afforded no moment of clarity in the weeks i have been pondering it. my world is somewhat noisy lately :)



Last edited on
Topic archived. No new replies allowed.