void CSceneRender::OnCameraZoomextents() { ScenePort * pDoc = dynamic_cast<ScenePort *>( GetDocument() ); ASSERT( pDoc ); m_TargetPosition = Vector3(0,0,0); m_TargetDistance = 50.0f; if ( pDoc->m_pSelectedNode ) { // find the world position of the selected node BaseNode * pBaseNode = pDoc->m_pSelectedNode->getCachedNode(); if ( pBaseNode ) { // get the hull of the selected node BoxHull hull( pBaseNode->hull() ); Vector3 position( 0.0f ); while( pBaseNode ) { if ( dynamic_cast< NodeTransform * >( pBaseNode ) ) { NodeTransform * pNode = (NodeTransform *)pBaseNode; position = (~pNode->frame() * position) + pNode->position(); } pBaseNode = pBaseNode->parent(); } m_TargetPosition = position; m_TargetDistance = hull.radius() * 2.0f; } } // redraw the scene OnUpdate(this,true,NULL); OnDraw(NULL); }