Hi Renan,

Renan Mendes wrote:
> what I mean with that. A snap is basically a sudden transformation of 
> the shape on the screen to a certain orientation and position in space 

Sorry, missed that the first time.
As I understand it you want to scale the Drawable to a given size, place it in 
a 
certain position?

To change the position, scale/size, or orientation of a Geode you should place 
a 
MatrixTransform above that node and set its matrix to do what you want. (To 
change the size of a single Drawable you'd have to modify it's coordinates 
directly.)

E.g. say you want to change to Geode to a certain size you could do the 
following:

// node hierarchy is xform=MatrixTransform -> Geode -> drawable=Drawable

// desired size
osg::Vec3 dSize(100,100,100);

// get current bounding box
const osg::BoundingBox& bbox = drawable.getBound();
osg::Vec3 bboxSize = (bbox._max - bbox._min);

xform->setMatrix(osg::Matrix::scale(bboxSize.x() / dSize.x(),
                                    bboxSize.y() / dSize.y(),
                                     bboxSize.z() / dSize.z()));

This is from memory, so it may not work out of the box.

/ulrich
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to