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.

DarkBASIC Professional Discussion / Camera 'Snap' on Mouse Look on/off

Author
Message
Sph!nx
17
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 31st Jul 2012 20:54
Hey everybody,

I thought it was time to update the camera in my 3D level editor.

Here is the code:


The camera enters and leaves mouse look upon pressing the space key. in mouse look, the camera angles are controlled through the mouse. Works good!

The problem I have is, whenever I enter mouse look, the camera 'snaps' the camera angles to the position of the mouse, before centring it (I guess).

I've ordered the code in different ways, experimented with conditions, tried to save and load the camera angles before the mouse controls take over... nothing worked.

Any help is much appreciated!

Regards Sph!nx
www.mental-image.net
Kezzla
17
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 1st Aug 2012 01:57
I had similar issues once and it came down to me adding the mouse x/y value to my mouse rotations causing it to jump.
try a startup condition that rotates the mouse to camera angle minus mouse angle before it updates for the first time. see if that works.

Sometimes I like to use words out of contents
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 1st Aug 2012 04:17
The jump is likely to be caused by the MOUSEMOVEX/Y() functions adding up when not in that mode.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Sph!nx
17
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 1st Aug 2012 14:07 Edited at: 1st Aug 2012 14:59
Thanks for your response!

@ Jezzla: I did a startup condition to setup the camera angles before entering mouselook (did not work) but I haven't tried it for the mouse... I'll try to do that!

@ WLGfx: Well, the mouselook function is under a condition only. So far as I know it does not add up outside of that mode.



Edit:
Quote: "try a startup condition that rotates the mouse to camera angle minus mouse angle before it updates for the first time. see if that works."
I've taken a look at it but I do not know how to set this up. I do not see how the current commands could be used this way. Could you please elaborate a bit more?

Regards Sph!nx
www.mental-image.net
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 1st Aug 2012 15:24
Whenever you call mousemovex() and mousemovey() it flushes the movement of the mouse, so I'd call them both once, before switching back into the mode that uses them so that it flushes.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Sph!nx
17
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 1st Aug 2012 16:05
Yes, it works great. Thank you very much!

Regards Sph!nx
www.mental-image.net

Login to post a reply

Server time is: 2026-07-07 12:27:14
Your offset time is: 2026-07-07 12:27:14