[osg-users] Unable to place model on vpb terrain. How To ?

Sanat Talmaki sanat.schumi at gmail.com
Fri Apr 8 11:10:29 PDT 2011


I am trying to place a model on a vpb terrain by supplying the lat-long coordinates. 

I followed a couple of threads in the forum that suggested to use the CoordinateSystemNode and ellipsoid model. But that didn't work for me (or maybe I am not following it right). 

I have attached the terrain along with my post.

So far this is what I am doing:

osg::ref_ptr<osg::Group> root = new osg::Group();
  osg::ref_ptr<osg::CoordinateSystemNode> csn = new osg::CoordinateSystemNode();
  csn->setEllipsoidModel(new osg::EllipsoidModel());  
  osg::ref_ptr<osg::Group> terrainGroup = new osg::Group();
  //osg::ref_ptr<osg::Node> terrain = osgDB::readNodeFile("NorthCampus6Levels.osg"); 
  osg::ref_ptr<osg::Node> terrain = osgDB::readNodeFile("NorthCampus6LevelsNoCS.osg");

  osg::Vec3d m_surface;
  csn->getEllipsoidModel()->convertLatLongHeightToXYZ(osg::DegreesToRadians(42.291966f), osg::DegreesToRadians(-83.715645f), 0.0f,

I tried using a visitor to find the CoordSystNode in my scenegraph but when I checked getEllipsoidModel I got a null.

I have used osgEarth in the past and was able to place a model on that. But I presently need to use vpb. If anyone can point me in the right direction, it would be great. 

Thank You.


Read this topic online here:


More information about the osg-users mailing list