Thanks Robert, Unfortunately, I currently don't have the luxury of doing it at construction time, but this is something I will probably address in the near future.
Is there an easy way to query whether or not a specific node already has a MatrixTransform sitting above it? (casting the results of getParent() perhaps?) I would like to avoid creating duplicate MatrixTransforms, especially for scenes that may be comprised of many rigid bodies. Thanks again E. --- Eric Maslowski Research Computer Specialist University of Michigan 3D Lab Autodesk 3D Studio Max Certified Trainer email: [EMAIL PROTECTED] office: 734-615-9699 > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:osg-users- > [EMAIL PROTECTED] On Behalf Of Robert Osfield > Sent: Thursday, September 21, 2006 14:55 > To: osg users > Subject: Re: [osg-users] simple question regarding transforms > > Hi Eric, > > Moving an abitary subgraph in the scene is done using one of the > osg::Transform subclasses. If you physics code works with 4x4 matrices > then use MatrixTransform, if you have a position, attitude (quaternion) > then PositionAttitudeTransform would be ideal. > > Inserting these transform nodes is easist done at scene graph construction > time, i.e. when you load the seperate items and place them in your scene. > > If you have a preexisting scene graph that you want to insert new > transforms into move previous static objects then you'll need to insert a > transform node above the subgraph of interest. To do this you need to > create the transfrom, add the subgraph to it, then on the subgraph's > original parent(s) you do a parent-.replaceChild(subgraph, transform). > > Now if you subgraph has parents you need to work out what to do, you have > move this one instance around of create multiple transform one for each > parent, the later is typically what would work best. > > > Robert. > > > On 9/21/06, Eric Maslowski <[EMAIL PROTECTED]> wrote: > > Hello all, > > In line with recent discussions regarding documentation and such, > what is > the recommended way to grab a arbitrary node from the scenegraph and > move it > manually? I'm working on integrating a physics engine with OSG and I > would > like to simply "bind" an osg node to the physics-based object so > that the > physics transform overwrites that of the OSG node. All nodes are > previously > loaded before building the physics objects so I have to query the > scenegraph > for the necessary elements. > > > > I can grab a node from the scene graph without issue, but just > moving the > object seems problematic. I have tried dynamic_cast, using > asTransform/asMatrixTransform routines, grabbing the parent and > casting/modifying that, but it never moves. What is the recommended > method? > > > > Thanks > > > > E. > > > > > _______________________________________________ > osg-users mailing list > [email protected] <mailto:[email protected]> > http://openscenegraph.net/mailman/listinfo/osg-users > http://www.openscenegraph.org/ > > > _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
