Getting Quick and Efficient Height Values of A FPS Style Map

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
Alpha Omega
Posts: 288
Joined: Wed Oct 29, 2008 12:07 pm

Getting Quick and Efficient Height Values of A FPS Style Map

Post by Alpha Omega »

So I am writing some code where I need to know how high an object is above a map, similar to a CSS map. Firstly can these type of maps be exported to a heightmap and then imported into Irrlicht as an ITerrianSceneNode? I didn't think so but if its possible let me know.

Thus I am using an IAnimatedMeshSceneNode* to import the map. I could test every vertices in the map and then interpolate to find the height the object is above the map but this seems to costly.

Does anyone have any friendly suggestion on how someone could determine the height relatively quickly?
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

what for would you use the height data?
Working on game: Marrbles (Currently stopped).
Alpha Omega
Posts: 288
Joined: Wed Oct 29, 2008 12:07 pm

Post by Alpha Omega »

serengeor wrote:what for would you use the height data?
To calculate the potential energy of an object. But maybe I don't actually need to do this if I pick a different reference frame to calculate the energy from...

Then I would need a position in space that would be the same for all objects of different heights instead of the level's surface.
cobra
Posts: 371
Joined: Fri Jan 23, 2009 2:56 am
Location: United States
Contact:

Post by cobra »

Hi, Alpha Omega.

I wouldn't suggest trying to load an FPS-style map in with a heightmap.

If you're using a physics engine, or you have Irrlicht collision setup, then a downward raycast is all you need. Make sure the raycast start point is higher than the highest point on the map.

Also, if you don't need to animate joints inside the map mesh or use stencil shadows, you should import it with addMeshSceneNode(), not addAnimatedMeshSceneNode().

- Josiah
Josiah Hartzell
Image
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

Fps style map can contain 3 or more story buildings so the potential energy would be calculated for the top most part which may lead to huge inaccuracies(maybe I'm wrong here), also the width and height should be really high in order to calculate things accurately(still much of inaccuracies will happen), so you should probably go with what cobra suggested.
Working on game: Marrbles (Currently stopped).
Alpha Omega
Posts: 288
Joined: Wed Oct 29, 2008 12:07 pm

Post by Alpha Omega »

Very nice cobra. I will attempt to implement this but it sounds very quick exactly what I need. Thanks man.
Post Reply