I've tried the following which seems to work pretty well for moving models on the paging terrain surface. Perhaps you can leverage this to do what you need.
double MissionFunctions::GetHeightOnTerrain(double lat, double lon)
{
double X,Y,Z;
double maxElevation = 13000.0 / 3.281; // make sure we're above the
highest point in the database (meters)
earth->convertLatLongHeightToXYZ(osg::DegreesToRadians(lat),
osg::DegreesToRadians(lon),
maxElevation, X, Y, Z);
double hat =
osgSim::HeightAboveTerrain::computeHeightAboveTerrain(terrain.get(),
osg::Vec3d(X,Y,Z), -1);
return (maxElevation - hat);
}
-Shayne
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
brettwiesner
Sent: Thursday, May 28, 2009 2:03 PM
To: OpenSceneGraph Users
Subject: [osg-users] Ground clamping to paging terrain
Hi,
I want to position something (let's say a building) to a terrain.
Currently I'm getting the Z value for the building doing this with an
osgUtil::IntersectVisitor and that works fine for static terrains. When
I run on a paging terrain (like one from osgEarth) and I position the
building, I get a Z value of the lowest LOD. Then more data pages in and
the building gets "buried" underground as more accurate data comes
available.
What's the most effiecient "ground clamp" things to paging terrain?
Thanks,
Brett
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

