Free look going mad....
Hi, i am building an animation editor and when the window's size is large (say 1000x800 or something) the free look rotating goes mad when you move the mouse and move at the same time (especially when strafing). It turns about 90 degrees right, and then 90 degrees left (from the original position). Is this a pretty common issue or is there something wrong in my code??
I rotate/translate the scene this way:
when moving the mouse: update the viewing point normal (direction): get the old position, subtract from the new, get the new normal.
when moving: move in the viewing point direction or to the left/right to it.
I think it must be caused by WM_MOUSEMOVE messages being queued due the high drawing time and when the first of a serie of WM_MOUSEMOVE messages is used to calculate the change of the normal, the value is too big. Is this a possible explanation, can i fix it, are there other possible causes?
Thanks in advance.
EDIT: When i stop moving the viewing angle corrects but when i loosen the mouse button before i stop moving it doesn't
[edited by - Tree Penguin on March 12, 2004 5:32:29 AM]
Damn. I post this just to let you know I read your post, however, I have no idea...
I can remember that years ago, when developing my internal movement-management API, I used to run the program forcing it in the 2-5fps. Then I dumped all mouse inputs to a files and checked it by hand every time something weird happened. It sometimes helped my.
By the way, does the same problem happen when using other input methods?
I can remember that years ago, when developing my internal movement-management API, I used to run the program forcing it in the 2-5fps. Then I dumped all mouse inputs to a files and checked it by hand every time something weird happened. It sometimes helped my.
By the way, does the same problem happen when using other input methods?
Previously "Krohm"
March 13, 2004 03:49 PM
Well, i use WM_MOUSEMOVE messages to see if the mouse has moved, then i use GetMousePos (or something) to get the screen coordinates and convert that to window coordinates. This goes all well btw and gets rid of some strange problems i had earlier. This only doesn''t solve the problem i am having right now.
Anyway, what other method would you suggest for an MFC MDI OpenGL app?
Anyway, what other method would you suggest for an MFC MDI OpenGL app?
March 13, 2004 04:21 PM
Well, i thought about what i do exactly and i think it is almost impossible that it is an input problem (as the messages, at least the handlers, don''t cross eachother and i always get the mouse pos once per handling and and i use the old pos to get the new angles) but what could it be then?
This is what i have:
camera rotation angles
camera direction normal
camera origin
modelview matrix (my own class, no problems at all)
mouse pos current
mouse pos old
This is what i do:
Drawing:
matrix.loadidentity();
matrix.rotatez(...);
matrix.rotatexy(...,...);
matrix.drawmodels(...); // not really like this but this isn''t important
Mouse Move:
update the mouse pos current variable using GetMousePos
update the normal using the current and old pos (i update the rotation values and i create the new normal out of it)
store the current mouse pos in the mouse pos old variable
Free look:
i move the camera origin in the direction of the camera direction normal
So, the problem is i don''t see any reason why these functions would work for all changes but not for large ones when moving the camera in a large window. I use doubles and i dont use some sort of LookAt (i just rotate using the rotation variables and then translate the camera using the camera origin variable) so it can''t be a lookat vertex precision matter.
Again what happens: when i make the window large and i move the mouse when moving in free look mode the rotation goes completely mad, it rotates left and right varying from 0 - over a 90 degrees but it restores if i stop moving using the ''wsad'' keys before i stop moving the mouse with the left mouse button pressed (which enables looking around).
Help, please!
This is what i have:
camera rotation angles
camera direction normal
camera origin
modelview matrix (my own class, no problems at all)
mouse pos current
mouse pos old
This is what i do:
Drawing:
matrix.loadidentity();
matrix.rotatez(...);
matrix.rotatexy(...,...);
matrix.drawmodels(...); // not really like this but this isn''t important
Mouse Move:
update the mouse pos current variable using GetMousePos
update the normal using the current and old pos (i update the rotation values and i create the new normal out of it)
store the current mouse pos in the mouse pos old variable
Free look:
i move the camera origin in the direction of the camera direction normal
So, the problem is i don''t see any reason why these functions would work for all changes but not for large ones when moving the camera in a large window. I use doubles and i dont use some sort of LookAt (i just rotate using the rotation variables and then translate the camera using the camera origin variable) so it can''t be a lookat vertex precision matter.
Again what happens: when i make the window large and i move the mouse when moving in free look mode the rotation goes completely mad, it rotates left and right varying from 0 - over a 90 degrees but it restores if i stop moving using the ''wsad'' keys before i stop moving the mouse with the left mouse button pressed (which enables looking around).
Help, please!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement