<div dir="ltr">Hi community,<div><br></div><div>I am aware from the search I did through the archive that some might resolved this and have it working - I am trying a simple thing, to move the camera on an ellipsoid using geodetic coordinates and euler angles (NED alike). All works, but the roll, rotation around Vec3(0,1,0) acts as changing its heading.</div><div><br></div><div>Here some snippets:</div><div><br></div><div><snip></div><div><div><span class="Apple-tab-span" style="white-space:pre"> </span>double lat = 36.9268;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>double lon = -75.9845;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>double alt = 5608.62;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>static double heading = 0.0;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>static double pitch = 0.0;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>static double roll = 0.0;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>osg::Vec3d euler(heading, pitch+osg::DegreesToRadians(90.0), roll);<span class="Apple-tab-span" style="white-space:pre"> </span></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>roll += osg::DegreesToRadians(1.0);<span class="Apple-tab-span" style="white-space:pre"> </span></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>osg::Matrixd mx = toMatrix(</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>0.0,0.0,0.0,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>osg::RadiansToDegrees(euler.x()), osg::RadiansToDegrees(euler.y()), osg::RadiansToDegrees(euler.z())</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>osg::EllipsoidModel em;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>osg::Matrixd l2w;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>em.computeLocalToWorldTransformFromLatLongHeight(osg::DegreesToRadians(lat), osg::DegreesToRadians(lon), alt, l2w);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>viewer->getView(0)->getCamera()->setViewMatrix(osg::Matrixd::inverse(mx * l2w));</div></div><div>....</div><div>....</div><div><div>osg::Matrixd toMatrix(double x, double y, double z, double h, double p, double r)</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>osg::Matrixd mxR;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>mxR.makeRotate(osg::DegreesToRadians(r), osg::Vec3(0, 1, 0));</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>osg::Matrixd mxP;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>mxP.makeRotate(osg::DegreesToRadians(p), osg::Vec3(1, 0, 0));</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>osg::Matrixd mxH;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>mxH.makeRotate(osg::DegreesToRadians(-h), osg::Vec3(0, 0, 1));</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>osg::Matrixd mxT;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>mxT.makeTranslate(osg::Vec3(x, y, z));</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>return (mxR*mxP*mxH*mxT);</div><div>}</div></div><div><br></div><div><br></div><div></snip><br clear="all"><div><br></div><div><br></div><div>Any clue? Thanks a bunch for any input!!!!</div><div><br></div><div>Cheers,</div><div>Nick</div><div><br></div>-- <br><div class="gmail_signature">trajce nikolov nick<br></div>
</div></div>