Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Camera Rotation Function Acting Weird

Author
Message
ReiKumar
16
Years of Service
User Offline
Joined: 23rd Sep 2008
Location:
Posted: 13th Oct 2009 08:00
Hey guys, I have this function thats supposed to rotate the camera when the user moves the mouse, but right now when I just click random places on the screen, the camera will suddenly jump to a random place.

Any guesses as to what wrong?



Note, mouseRight is a bool that is set by another function after it checks whether the right mouse has been pressed or not.
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 13th Oct 2009 16:26
I have no idea if this is a factor in GDK, like it is in DBPro - but try forcing those 15's to be floats, 15.0 instead of 15 - as DBPro would take that code and only move the camera when you move in 15 pixel lumps, which is pretty rare for a mouse.

So I think it's that 15, forcing the number to be an integer, which is 0 most of the time but if you move the mouse real fast it will update the rotation.

Worth a try at least .


Health, Ammo, and bacon and eggs!
Ultimate_H
15
Years of Service
User Offline
Joined: 11th Mar 2009
Location: A place that is neither here nor there
Posted: 13th Oct 2009 20:10
I had this problem as well. I think what happens is that GDK stores the current position of the mouse when the movement functions are called. Thus, each time it is called it compares the previous position stored to the current position, and the overwrites the old position. That could be the reason.

What I would suggest is that each time the mouse is initially clicked, you "dump" the mouse move functions into unused variables once, and then mess with the camera angle. It worked for me.

Here is what I am talking about:


This makes it where the camera moves only as much as you move the mouse after clicking, and not before as well.

The not-so-ultimate Ultimate_H

Login to post a reply

Server time is: 2024-10-01 14:32:22
Your offset time is: 2024-10-01 14:32:22