Horde3D
http://horde3d.org/forums/

How to get terrain height ?
http://horde3d.org/forums/viewtopic.php?f=2&t=1684
Page 1 of 1

Author:  Sisyphe [ 21.06.2012, 09:04 ]
Post subject:  How to get terrain height ?

Hey all,
I'm using the Terrain Extension and I'm trying to set my character on the ground, but I didn't find how to get the terrain height at a specific position.
I know the castRay function, but I hope there is a better way to do that.
Thanks !

Author:  Sisyphe [ 28.06.2012, 16:03 ]
Post subject:  Re: How to get terrain height ?

Please, I really need help, I didn't found anything about it.
I saw some demos on youtube which managed to set models on the terrain, but the sources are not available.

Author:  Volker [ 29.06.2012, 06:52 ]
Post subject:  Re: How to get terrain height ?

There's no direct access to the _heightData array in the terrain extension. If you want to use the terrain in e.g. a physics engine for intersection tests, you should use the h3dextCreateTerrainGeoRes method to create a geometry resource for a specific level of detail. The terrain detail is normally adjusted based on the distance to the viewer, but I guess that's something that would not be usable for your use case (even I don't know exactly what you're using the height for).
So you can create a static geometry mesh resource with the complete terrain and use the vertex data for your physics calculation.
You can find an example in the GameEngine. The vertex data of the terrain is fetched in SceneGraphComponent.cpp Line 322 et seq. and is transfered to the bullet phyiscs engine in PhysicsComponent.cpp Line 233 et seq.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/