Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

boldyman

Terrain. Im stuck please help !!!

This topic is 6086 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I am trying for 2 months now , to get the height of a terrain at ANY x/z position. But i can''t get it to work or work correctly. I used the getheight method from opengl game programming book but this gives a bumppie effect. And if the hill is to high i can get the y pos and i walk right through the hill. Can someone PLEASE explain to me how i can get the ypos at any point on the terrain. (Or even better some code or pseudo code). Some details of the method i use, almost the same as in ogl game programming: I give up the mapx mapx and mapscale. I read the terrain from a heightmap. It is stored in a terraindata[mapx][mapz][3]. Calculating the height points: terraindata[x][z][0]= float(x)*mapscale terraindata[x][z][1]= (float)heightmap[z*mapz+x)*3] terraindata[x][z][2]= -float(z)*mapscale The vertices are drawn in this order 0---->1 / / 2---->3 And render it using GL_TRIANLE_STRIP Thanks Boldyman

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!