[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


Hi,

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:


Code:
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");
  terrainGroup->addChild(terrain);

  osg::Vec3d m_surface;
  csn->getEllipsoidModel()->convertLatLongHeightToXYZ(osg::DegreesToRadians(42.291966f), osg::DegreesToRadians(-83.715645f), 0.0f,
                                                      double(m_surface.x()),double(m_surface.y()),double(m_surface.z())
                                                     ); 



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.

Sincerely,
Sanat

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=38336#38336




Attachments: 
http://forum.openscenegraph.org//files/northcampus6levels_171.osg





More information about the osg-users mailing list