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 angle

Author
Message
Grenadiac111
14
Years of Service
User Offline
Joined: 23rd Dec 2009
Location:
Posted: 20th Jan 2010 03:33
in my project the mouse controls the X and Y angle of the camera but the problem is that if the player keeps moving the mouse forward or backward the camera will do a front or backflip. could someone please tell me how to stop the camera from making a flip.
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 20th Jan 2010 06:28
Store the angles in 2 floats, then add to them via dbMouseMoveX/Y and clamp the X rotation value to -90..90 or something then rotate the camera by these values every frame.

Grenadiac111
14
Years of Service
User Offline
Joined: 23rd Dec 2009
Location:
Posted: 20th Jan 2010 22:24
Quote: "and clamp the X rotation value to -90..90 or something then rotate the camera by these values every frame"


what do you mean by clamp the Xrotation and rotate the camera every frame?
Aldur
17
Years of Service
User Offline
Joined: 8th Oct 2007
Location: Melbourne, Australia
Posted: 20th Jan 2010 23:21
If the camera x angle is greater than 90 then make the x angle 90
if it is less than -90 make it -90.



Freedom Fighters
15
Years of Service
User Offline
Joined: 2nd Nov 2009
Location:
Posted: 20th Jan 2010 23:44
here, i use this for my camera



this code from the last code box is what limits its looking up and down.



Problem Solution That Never Fails: "Build A Bridge And Get Over It"
Grenadiac111
14
Years of Service
User Offline
Joined: 23rd Dec 2009
Location:
Posted: 21st Jan 2010 05:29
thanks i just dont understand i didnt think to regulate the angle with an if statement.

Login to post a reply

Server time is: 2024-11-20 05:27:58
Your offset time is: 2024-11-20 05:27:58