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 / Camera coding problems

Author
Message
Seraphim Pwns U
19
Years of Service
User Offline
Joined: 13th Jul 2006
Location:
Posted: 13th Jul 2006 17:03
I'm making a 3d RPG, however, I'm a bit stumped on the camera control. What I'm trying to do is, when the right mouse button is held, the camera becomes 'free-roaming' of sorts. left and right rotates the camera around the character, up and down modifies the height of the camera (although still focused on the character), and holding first the right and then the left buttons will enable zooming. In the meantime, if the character is walking while the buttons are clicked, the camera will still follow the character.

I have it somewhat working. I can rotate it around the character (although I can't figure out why the camera is resting below ground level [the regular camera view sits at a standard "hover behind and above the character"-3rd person view]), the vertical rotation needs tweaking, I can't zoom, and following doesn't happen.

Attached are my camera routines. Any help would be greatly appriciated. If the entire code needs to be seen, pm/email me.

Famous Last Words:
...oh, it's only a horde of skeletons, I can take them on single handedly. I'm lvl 20!
flock
20
Years of Service
User Offline
Joined: 10th Mar 2006
Location: Earth
Posted: 13th Jul 2006 18:24
First off, you have your camera positioning and rotation in an IF argument. That's a no-no.

So far, this is what I've come up with. Just give me a little while to complete it:





Bear with me, I've never really taken on a post this challenging cause I don't like messing our in the 3D part of DBC. Others may reply, but I'll still be tweaking this until I post it on the Code Snippets forum.

Post again soon.

a.k.a. "flockhound"
Seraphim Pwns U
19
Years of Service
User Offline
Joined: 13th Jul 2006
Location:
Posted: 13th Jul 2006 19:31
After reading/running the code you posted, it comes across as 'wiggling' the camera near the box (for lack of a better description...). *ponders* In pseudocode, I need something to the extent of :

While rightmousebutton is held
if mousemovex rotate camera x around character
if mousemovey inc camera height from ground (but stay focused on character)
if leftmousebutton is held too (assuming the right one is still being held), then
if mousemovey
zoom in if inc(y)
zoom out if dec(y)
endwhile

Hope this clarifies my thoughts and needs a little bit.

Famous Last Words:
...oh, it's only a horde of skeletons, I can take them on single handedly. I'm lvl 20!

Login to post a reply

Server time is: 2026-07-06 18:37:10
Your offset time is: 2026-07-06 18:37:10