Tony, "Entity" is just my own class that can represent an airplane, tank, or whatever.
The member "Entity->transform" is an osg::MatrixTransform which you'll need for moving models. "entityGrp" is an osg::Group*. -Shayne -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Tony Vasile Sent: Thursday, February 04, 2010 11:25 PM To: [email protected] Subject: Re: [osg-users] Example of geographical position 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
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

