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 Discussion / max and min camera angles

Author
Message
andycb
17
Years of Service
User Offline
Joined: 12th Jan 2008
Location:
Posted: 12th Jan 2008 19:55
if you turn the camera using the mouse (or anything else for that matter) is it possible to stop the camera turning once it reaches a maximum angle e.g. +/- 90degrees on the x axis?
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 13th Jan 2008 00:38
Yes - use a variable for the actual angle - like CamAngX#.

Then, immediately after altering it's value (but before using the command which actually sets the camera's angle) do a quick If..Then check along the lines of:



TDK_Man

andycb
17
Years of Service
User Offline
Joined: 12th Jan 2008
Location:
Posted: 13th Jan 2008 20:04
TDK
Quote: "If LeftKey()=1 Then Inc CamAngX#,WrapValue(CamAngX#+0.5)
If CamAngX# > 90.0 Then CamAngX# = 90.0
Rotate Camera CamAngX#,CamAngY#,CamAngZ#"


This works fine if your using the keyboard to control where the camera points but do you know how you would do it if you use the mouse for code that looks like this -


which comes from the online tutorial for the monstor hunt game.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 13th Jan 2008 20:16
Exactly the same way.



TDK_Man

andycb
17
Years of Service
User Offline
Joined: 12th Jan 2008
Location:
Posted: 14th Jan 2008 21:10
Thanks for the help.

Login to post a reply

Server time is: 2025-06-02 09:56:21
Your offset time is: 2025-06-02 09:56:21