Shayne,
   What is the type of Entity and entityGrp in the following code snippet?

Along with Robert's suggestion, you can use the following code snippet to
place a vehicle on a spheroid that has VPB terrain, into the scenegraph.
You'll need osgSim and osg::EllipsoidModel to do this.

Entity->lat = 36.4;
Entity->lon = -115.015;
Entity->alt = GetHeightOnTerrain(Entity->
lat, Entity->lon);
entityGrp->addChild(Entity->transform);

double GetHeightOnTerrain(double lat, double lon)
{
       double X,Y,Z;
       double maxElevation = 13000 / 3.281;
       earth->convertLatLongHeightToXYZ(osg::DegreesToRadians(lat),
osg::DegreesToRadians(lon),maxElevation, X,Y,Z);
       double hat =
osgSim::HeightAboveTerrain::computeHeightAboveTerrain(terrain.get(),
osg::Vec3(X,Y,Z), -1);
       return (maxElevation - hat);
}

The "earth" is an osg::EllipsoidModel object and the "terrain" is a node
loaded in from the ive file build by VPB. The entity group node is simply
added to your scenegraph and you're ready to go.

Hopefully this will get you started...:)

-Shayne
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to