Jump to content

  • Log In with Google      Sign In   
  • Create Account


Efficient height calculation for walking on terrain


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 cstony   Members   -  Reputation: 384

Like
0Likes
Like

Posted 15 July 2008 - 10:48 AM

I am creating a simple fps and Im trying to decide on the best method of determining the height of the player due to the terrain. The terrain is generated from a heightmap and so it is essentially a set of height values on a cartesian grid. With this in mind, I get the player x,z coordinates to find which height values are relevant with respect to the current player position. Now, Im unsure of the best method for determining the height. Am I better of using collision testing and pushing the player up when the bounding box collides with the terrain? or simply interpolating between the height values and setting the players height position (y-value) that way. Both methods seem to work to me but Im not sure which is the most commonly used approach (im leaning towards interpolation looking easier, but want to make sure Im not missing something), or if another method completely is used :)

Sponsor:

#2 0BZEN   Crossbones+   -  Reputation: 2013

Like
0Likes
Like

Posted 15 July 2008 - 11:07 AM

Depends what you want to achieve, but interpolation will basically give you the height under the player's feet. That can be enough (guild wars seems to do something similar). It's also very fast of course.

#3 cstony   Members   -  Reputation: 384

Like
0Likes
Like

Posted 15 July 2008 - 11:23 AM

Yes, thats the basic effect that I am trying to achieve at this moment. I just wanted a more experienced opinion before I started the implementation. Thanks for the quick reply ++rating

#4 Zipster   Crossbones+   -  Reputation: 625

Like
0Likes
Like

Posted 15 July 2008 - 11:27 AM

The smaller the objects, the more you can get away with using interpolation. However once your objects become bigger, the height at a single point will become a bad approximation and you'll end up with a lot of clipping if you don't handle the collision properly. I would stick with interpolation at least until it doesn't handle everything you need it to.

#5 Genjix   Banned   -  Reputation: 100

Like
0Likes
Like

Posted 16 July 2008 - 11:09 PM

depends how he generates the terrain :)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS