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 view code with no "upside-down"?

Author
Message
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 22nd Nov 2012 15:18
I'm using the following code for a FPS style space combat game



But the problem is with that code, when the camera is rotated upside down the right & left is flipped, and in space there's no upside down.
Hopefully you can understand what I'm trying to describe..
Any ideas?

http://mattsmith.carbonmade.com/
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 22nd Nov 2012 15:27
Try using the turn, pitch and roll commands.



Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 22nd Nov 2012 15:29
just limit the xrotattion of the camera..
step 1: track the limits of camera angle x()
text 0,0,"Cam X: "+str$(camera angle x())
step 2: move the mouse up/down untill you get the limitations that you want to set into your camera (wich will be something like 80 and -80)
step 3: put it into your code, such as:

cx#=wrapvalue(cx#+mousemovey())
if cx# > 80 then cx# = 80
if cx# < -80 then cx# = -80

how easy is that?

Advanced Updater for your games!
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 22nd Nov 2012 16:04
@fallout how would I integrate that with my current code?

http://mattsmith.carbonmade.com/
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 22nd Nov 2012 17:10 Edited at: 22nd Nov 2012 17:10
Sergey is right if you are doing a standard FPS. I was thinking more along the lines of, if you want to be able to go in any direction, like a space sim.

You could swap your code like this:


wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 22nd Nov 2012 19:18
Thanks, that sort of works. Unfortunately when looking straight up or straight down the camera just rolls instead of turning right or left.

@Sergey yeah I'm not trying to limit the view, I'm trying to get a full 360 degrees.

http://mattsmith.carbonmade.com/
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 22nd Nov 2012 22:20
Quote: "Thanks, that sort of works. Unfortunately when looking straight up or straight down the camera just rolls instead of turning right or left. "


It's all down to the order you use the commands. Swap the pitch and turn commands round and see if you prefer that result.

Login to post a reply

Server time is: 2026-07-08 14:12:31
Your offset time is: 2026-07-08 14:12:31