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 / Camera Following Terrain Question

Author
Message
Servant Saber
16
Years of Service
User Offline
Joined: 8th Aug 2008
Location:
Posted: 20th Oct 2008 02:14
I've been working on a basic outdoor level, and I can't seem to understand how to have the camera object stay level on the terrain,
As in if the camera encounters a hill, it stays level with the terrain,
Any Ideas?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 20th Oct 2008 10:38
It depends on how you have created your terrain. If you used the advanced terrain commands, then the command you need is GET TERRAIN GROUND HEIGHT :

return float = GET TERRAIN GROUND HEIGHT( Terrain ID, X, Z )

If you used a model, then you'll have to use collision commands to get the height.

If you used a matrix, then the command is GET GROUND HEIGHT.

Once you have that, offset your camera Y position by this value plus the distance above the ground.

Servant Saber
16
Years of Service
User Offline
Joined: 8th Aug 2008
Location:
Posted: 21st Oct 2008 01:15
I'm using Visual Terrain Maker to make .X model files.
How Would I go about offsetting my camera?

My code is set up like this


Sorry for asking you to spell it out, but I'm still new to Darkbasic
pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 24th Oct 2008 10:21
use intersect object( )

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-24 19:53:46
Your offset time is: 2024-11-24 19:53:46