<div dir="ltr">Hi,<div><br></div><div>R u working on Vizard software?</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><span style="color:rgb(136,136,136)">-- </span><br style="color:rgb(136,136,136)"><div dir="ltr" style="color:rgb(136,136,136)"><font color="#000000">Regards</font></div></div>Hitesh Singhal<div>Electrical Engineering<br><div>+91-8386837430<br><div><br></div></div></div></div></div></div>
<br><div class="gmail_quote">On Fri, Jun 19, 2015 at 8:23 AM, shilpa varri <span dir="ltr"><<a href="mailto:shil.reddy9@gmail.com" target="_blank">shil.reddy9@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'm using trackball manipulator to rotate my camera.<br>
I have following inputs:<br>
eye position, lookAtCenter position, up vector and spin center.<br>
So basically I need to setup my trackballmanipulator such that it is located at 'eye' position looking at 'lookAtCenter' position with 'up' vector. But when I move my mouse I need the manipulator to rotate about 'spin center' and not 'lookAtCenter'.<br>
So the camera is looking at one point but rotating around a different point.<br>
<br>
Now if I use the 'trackballmanipulator->setTransformation(eye, lookAtCenter , up)' when I move the mouse it automatically moves along the sphere of 'lookAtCenter'.<br>
I'm not sure how to overwrite this behavior so that it's looking at 'lookAtCenter' position but rotating about sphere of 'spin center'.<br>
<br>
I've calculated the rotation matrix to rotate about 'spin center'. But how do I feed this to the trackballmanipulator to achieve the result?<br>
Can anyone please help me?<br>
<br>
<br>
Here's the code:<br>
osg::Vec3d eye = osg::Vec3d(cameraPos.at(0), cameraPos.at(1), cameraPos.at(2));<br>
osg::Vec3d viewVector = osg::Vec3d(cameraViewDirection.at(0), cameraViewDirection.at(1), cameraViewDirection.at(2));<br>
osg::Vec3d lookAtCenter(eye + viewVector);<br>
osg::Vec3d up = osg::Vec3d(cameraUpDirection.at(0), cameraUpDirection.at(1), cameraUpDirection.at(2));<br>
<br>
osg::Vec3d spinCenterVec = osg::Vec3d(spinCenter.at(0), spinCenter.at(1), spinCenter.at(2));<br>
<br>
osg::Matrixd transSpinToOrigin, transToSpinCenter, rotationAboutOrigin;<br>
<br>
transSpinToOrigin.makeTranslate(-spinCenterVec );<br>
transToSpinCenter.makeTranslate( spinCenterVec );<br>
rotationAboutOrigin.makeRotate( osg::DegreesToRadians(0.5), osg::Vec3d(1,0,0),<br>
osg::DegreesToRadians(0.5), osg::Vec3d(0,1,0),<br>
osg::DegreesToRadians(0.5), osg::Vec3d(0,0,1) );<br>
<br>
m_customRotationMat = new osg::Matrixd(transToSpinCenter * rotationMat * transSpinToOrigin);<br>
<br>
trackBallManipulator->setTransformation(eye, referencePtVector, up);<br>
<br>
//After this, how do I use 'm_customRotationMat'? I've started overriding the manipulator class so I can use this somewhere. But I still don't know how?<br>
<br>
Any help is much appreciated!<br>
Thank you!<br>
<br>
Cheers,<br>
avatarZ<br>
<br>
------------------<br>
Read this topic online here:<br>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=64125#64125" rel="noreferrer" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=64125#64125</a><br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div><br></div>