Hi,

I'm trying to make a tank move across a terrain.

The terrain is created by reading the image files of Puget Sound that i downloaded from http://www.cc.gatech.edu/projects/large_models/ps.html
as mentioned in the quick step-by-step guide for OsgDem. Then I setElevationLayer and setColorLayer to an instance of osgTerrain::TerrainNode. The terrain seems to display fine.

I added a "tank" node and attached it to a PositionAttitudeTransform. To make the "tank" move, it is set to a callback whereby it sets the new position of the tank to make it look like it is moving in a circle. The callback needs to check the elevation of the terrain so that the tanks "moves" according to terrain, so to do this I used the function "computeTerrainIntersection" from the example osgparticleeffects. Problem is, computeTerrainIntersection doesn't seem to be able to detect the elevation. I stepped through this function and it seems that osgUtil::IntersectVisitor doesn't seem to get any "hits". I did notice however that if I build the terrain by setting its elevation using osgHeightField as is used in the example osgparticleeffects, the elevation can be detected just fine.

How do I make the function "computeTerrainIntersection" return me the correct elevetion?

Thanks in advance for your help.

Weng Heng
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to