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.

Dark GDK / Height Check?

Author
Message
Under_score
13
Years of Service
User Offline
Joined: 5th Oct 2010
Location:
Posted: 11th Jul 2011 23:08
I'm working with the standard terrain file, and I'm trying to make sure I can't move to a spot that is higher that a certain height. I have the pseudo code, but I don't know what values to use.

I'm just wondering what the value would be for the position directly in front of the camera.
I'm sorry if this is a little vague, but all help would be appreciated.

_______________
/Sottolineamento\
\_______________/
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 12th Jul 2011 20:23
The easiest way I know is to move the camera, check the value and then move the camera back if it's beyond what you want for collision. The problem I found with terrain (though it's not an actual problem) is that if your height map has no RGB(0,0,0) in it, the terrain maker will make no spot that is actually at Y==0. You have to take that into account. I suggest using a moving Y-value. Take the current Y-value and compare it to the Y-value where your character is "going to be" and if it's above whatever your thershold is, then don't let the character move there.

The fastest code is the code never written.

Login to post a reply

Server time is: 2024-05-22 09:07:30
Your offset time is: 2024-05-22 09:07:30