Hi,

I tried to place cessna model at given latitude and longitude on a earth model 
created by geotiff earth file warped over sphere (similar to the example 
osgSimulation). But the model is positioned at some strange place. The way I do 
placing is,

...............
.....................
osg::Node* cessna = osgDB::readNodeFile("cessna.osg");
if (cessna)
{
double s = 200000.0 / cessna->getBound().radius();

osg::MatrixTransform* scaler = new osg::MatrixTransform;
scaler->addChild(cessna);
scaler->setMatrix(osg::Matrixd::scale(s,s,s)*osg::Matrixd::rotate(rotation));
scaler->getOrCreateStateSet()->setMode(GL_RESCALE_NORMAL,osg::StateAttribute::ON);

osg::MatrixTransform* mt = new osg::MatrixTransform;
mt->addChild(scaler);
....
....
 rot.makeRotate(osg::DegreesToRadians(90.0),0.0,0.0,1.0);
....
...
osg::EllipsoidModel* ellipsoid = csn->getEllipsoidModel();
if (ellipsoid)
{
    osg::Matrixd matrix;

        lat=11.0;
        lon=78.0;
        ht=100.0 * 1000.0;

    
ellipsoid->computeLocalToWorldTransformFromLatLongHeight(lat,long,ht,matrix);
    matrix.preMultRotate(rot);                
    mt->setMatrix(matrix);
}

csn->addChild(mt);
.......
....

The coordinate system node is of the earth file (Geotif). I wud like to know 
the mistake I do.

Thanks

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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to