<div dir="ltr"><div>Hi Becky,</div><div><br></div><div>I managed to change the camera position using a manipulator called controller.<br></div><div><br></div><div> viewer.setCameraManipulator(controller);<br> viewer.realize();<br> // osg::Matrix matrix;<br> // matrix.makeLookAt( osg::Vec3(), osg::Vec3(), osg::Vec3() );<br> osg::Quat quad;<br> // matrix.get(quad);<br> controller->setTransformation(osg::Vec3(-54.4f,-14.3f,80.0f), quad );<br> while ( !viewer.done() )<br> {<br> viewer.frame();<br> }<br> return 0;<br></div><div><br></div><div>The commented lines were not necessary for me, but may be in other situations.</div><div><br></div><div>Best,</div><div>Rodrigo.<br></div><div><br></div><br>On Tuesday, April 1, 2014 at 6:37:24 AM UTC-3, ying song wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Hi,
<br>
<br>I draw a box using addDrawable. Then I want to change the position and rotation angle of the camera by:
<br>
<br>viewer->getCamera()-><wbr>setViewMatrix(<wbr>cameraTranslationMatrix);
<br>
<br>But actually it makes no change to the camera. The cube is still in the center of the screen after run the scene.
<br>
<br>I also tried to update the frame by using the following code, but also failed:
<br>
<br>while(!viewer->done())
<br>{
<br> viewer->getCamera()-><wbr>setViewMatrixAsLookAt(eye,<wbr>center,up);
<br> viewer->frame();
<br>}
<br>
<br>
<br>Would anyone tell me what could I do to move the camera?
<br>
<br>Thank you!
<br>
<br>Cheers,
<br>Becky
<br>
<br>------------------
<br>Read this topic online here:
<br><a href="http://forum.openscenegraph.org/viewtopic.php?p=58769#58769" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fforum.openscenegraph.org%2Fviewtopic.php%3Fp%3D58769%2358769\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEekuAAT68VySslrdPavrOgBTIhmg';return true;" onclick="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fforum.openscenegraph.org%2Fviewtopic.php%3Fp%3D58769%2358769\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEekuAAT68VySslrdPavrOgBTIhmg';return true;">http://forum.openscenegraph.<wbr>org/viewtopic.php?p=58769#<wbr>58769</a>
<br>
<br>
<br>
<br>
<br>
<br>______________________________<wbr>_________________
<br>osg-users mailing list
<br><a href="javascript:" target="_blank" gdf-obfuscated-mailto="V3rEPFmmtaoJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">osg-...@lists.<wbr>openscenegraph.org</a>
<br><a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Flists.openscenegraph.org%2Flistinfo.cgi%2Fosg-users-openscenegraph.org\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEhxcobqaKtkSCnaCeBWJ1fFl93mw';return true;" onclick="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Flists.openscenegraph.org%2Flistinfo.cgi%2Fosg-users-openscenegraph.org\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEhxcobqaKtkSCnaCeBWJ1fFl93mw';return true;">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a>
<br></blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:osg-users+unsubscribe@googlegroups.com">osg-users+unsubscribe@googlegroups.com</a>.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/osg-users/f32cce3f-4ae4-45b4-8efe-be93a362a1a3%40googlegroups.com?utm_medium=email&utm_source=footer">https://groups.google.com/d/msgid/osg-users/f32cce3f-4ae4-45b4-8efe-be93a362a1a3%40googlegroups.com</a>.<br />