Hi, Shayne, so I've been trying your solution for HAT and am having little luck. I've worked through a few things to be sure that I'm getting the reasonable numbers etc but it seems that i always get the same height back as I put into the. \
I must be missing something... help would be appreciated! terrain is pagedLOD and created with vpb using the --geocentric flag pos = lat, lon, height_above_sealevel (maybe that should be above the center of the earth?) ... Code: getHat(osg::Vec3f pos, osg::Node* target) { // turn off OSG_NOTICE which prints out from computeIntersection called from computeHeightAboveTerrain osg::setNotifyLevel(osg::WARN); osgSim::HeightAboveTerrain myhat; // print what I pass in.... something like lat 32.???, lon -111.???, height = 545.??? printf("inlat, inlon, inhgt = %f %f %f \n",pos[0],pos[1],pos[2]); // get the world XYZ coords double X,Y,Z; dynamic_cast<osg::CoordinateSystemNode*>(target)->getEllipsoidModel()->convertLatLongHeightToXYZ( osg::DegreesToRadians(pos[0]), osg::DegreesToRadians(pos[1]), pos[2], X,Y,Z); // the resulting XYZ looks like reasonable numbers... X & Y in the neg millions, Z pos mill printf("X,Y,Z = %f %f %f\n",X,Y,Z); // just want to check that nothing messed up the numbers double lat, lon, height; em->convertXYZToLatLongHeight(X,Y,Z,lat,lon,height); printf("lat lon height = %f %f %f\n",osg::RadiansToDegrees(lat),osg::RadiansToDegrees(lon),height); if( Scene* scene = dynamic_cast<Scene*>( m_viewer.getSceneData() ) ) { osg::Node* terrain = scene->getEarthModel(); hat = osgSim::HeightAboveTerrain::computeHeightAboveTerrain(terrain,osg::Vec3d(X,Y,Z)); printf(" HAT = %f pos = %f %f %f\n",hat, X, Y, Z); } } here is the output inlat,inlon,inhgt = 32.875961 -111.756973 545.467957 X,Y,Z = -1987688.866583 -4980417.869354 3442709.618813 lat lon height = 32.875961 -111.756983 545.467957 HAT = 545.467957 pos = -1987688.866583 -4980417.869354 3442709.618813 do I need to set something about the terrain lowest elevation? Cheers, lawrence ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58755#58755 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org