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 / Reading terrain height in front of player (like raycast)

Author
Message
mnemonic
19
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden
Posted: 10th Jun 2012 23:54
Hi, I have made an FPS controller. It is basically a camera following an object and the object follows the terrain. I came up with an idea on how to calculate the angle of the terrain part in front. Since the player turns around with the camera (mouselook) calling move object player will move it in the direction it's facing. The problem is to read the height in front of him, a call to object position z will return the objects WORLD z coordinate, I need to get the OBJECT coordinate somehow to make like a raycasting. Anyone knows how to do this?

Best!

www.memblockgames.com
david w
20
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 11th Jun 2012 00:13
1. position an object at player position
2. Use Move object to the #of units you wish to check.
3. Use the appropriate GetTerrainHeight command at the coords of the moved object
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Jun 2012 00:43
Here's a thread that explain it.

http://forum.thegamecreators.com/?m=forum_view&t=197138&b=1

Cheers.

I'm not a grumpy grandpa

Login to post a reply

Server time is: 2026-07-08 00:25:36
Your offset time is: 2026-07-08 00:25:36