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.

Newcomers DBPro Corner / Controlling the camera?

Author
Message
Tom J
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: Essex, England
Posted: 8th Dec 2007 23:21
This is a little flight simulator I was working on, I have nearly got the camera sorted; however the problem is that I need to use the "set camera to object orientation" command to allow the camera to fully follow the vehicle.

This means that it is very easy for the "plane" to go off screen if you turn, especially if you turn upwards or downwards. Is there a command that will let me control the camera if the plane is close to going off screen, so that the plane stays on screen?

Use the mouse to move, LMB to accelerate.


Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 9th Dec 2007 00:33 Edited at: 9th Dec 2007 00:44
i'd re-write the camera routine to something like: (pseudocode)

position camera playerx#, playery#, playerz#
set camera to object orientation player
move camera -200.0

that would keep the camera (200 units) behind the player at all times.

apply off-sets as desired. ie:

if you wanted to keep the camera slightly above the player, you could change line 1 to:

position camera playerx#, playery#+20.0, playerz#

if you wanted the camera to dynamically fall further behind the player based on velocity, you could do something like this to line 3:
move camera (-200.0 - (velocity/2.0))

the method (placing then applying off-sets) can make for some slick camera work.

hope this helps

Virtual Nomad
AMD XP 1800+ (~1.6 Ghz) / 1.5 GB RAM
ATI Radeon 8700LE 128 MB / Windows XP
Tom J
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: Essex, England
Posted: 10th Dec 2007 19:57
Awesome That was very helpful indeed, thanks!

Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 11th Dec 2007 12:46
Or you could use SET CAMERA TO FOLLOW X, Y, Z, Distance, Height, Smoothing, Collision (I usually set the collision thing to 0).

Check the help files for more on this command...

Login to post a reply

Server time is: 2024-09-27 08:24:46
Your offset time is: 2024-09-27 08:24:46