Hi all, I set my camera manipulator to face a specific node when I double click on it using this code:
// get the node path from this node to the scene root osg::NodePathList paths = i_pNode->getParentalNodePaths(); osg::NodePath & nodePath = paths[0]; // accumulate all the transforms in the node path to get to the // world coordinate transform for this node osg::Matrix Xform = osg::computeLocalToWorld( nodePath ); // transform the local viewpoint to world coordinates osg::Vec3 LookFrom, LookAt, Up; i_pNode->BestView( LookFrom, LookAt ); LookFrom = LookFrom * Xform; LookAt = LookAt * Xform; Up = osg::Vec3(0,0,1) * Xform; // set new home position m_Viewer->getCameraManipulator()->setHomePosition( LookFrom, LookAt, Up ); BestView(..) returns a desired eye and center position (in local coordinates) when looking at the node. This works fine in the sense that the camera position is set exactly where I want it, but the Up vector doesn't change according to the node's attitude. The camera pitch and yaw is spot on, but roll is not changed from the default up position. Is the above the correct way to calculate the new Up vector? As always, any help is greatly appreciated. Thanks, Morne
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
