Hi Sanat -- I don't see where you are getting the parent transformation matrix
from. You need a NodePath leading up to the node parameter, and then you can
getLocalToWorld() from that NodePath.
There are also a couple other things you should know about that might help:
osgWorks provides functions to directly transform OSG bounding volumes. See the
<osgwTools/Transform.h> header.
Also, svn trunk of osgWorks (warning: under heavy development pushing towards a
2.0 release) now contains versions of the makeBox(), makeWireBox(),
makeAltAzSphere(), etc, functions that take an osg::Matrix as the first
parameter, and return a Geometry that is already transformed by that matrix.
I hope this info helps.
--
-Paul Martz Skew Matrix Software
http://www.skew-matrix.com/
--
You received this message because you are subscribed to the Google Groups "osgworks-users" group.
To post to this group, send email to osgworks-users@googlegroups.com.
To unsubscribe from this group, send email to osgworks-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/osgworks-users?hl=en.
That would work, except from your code below, if the last Node in the NodePath
is a Transform node, then you need to make a copy of the NodePath and pop the
Transform off the back. Otherwise that Transform would be applied twice, once in
the matrix derived from the NodePath and once in the geometry of the BoundingBox.
> 2) Placing the Matrix transform from above under the parent node of the object
> whose sphere is created. (as expected, this shows results as if transforms
> were applied twice over - once from the parent node and once from the world
> coordinates matrix).
That won't work, but osgWorks has AbsoluteModelTransform. If you use that
instead of MatrixTransform, it should work. Of course you still need to handle
the case where the last Node in your NodePath is a Transform (as I mentioned
previously).
-Paul
That would work, except from your code below, if the last Node in the NodePath is a Transform node, then you need to make a copy of the NodePath and pop the Transform off the back. Otherwise that Transform would be applied twice, once in the matrix derived from the NodePath and once in the geometry of the BoundingBox.
That would work, except from your code below, if the last Node in the NodePath is a Transform node, then you need to make a copy of the NodePath and pop the Transform off the back. Otherwise that Transform would be applied twice, once in the matrix derived from the NodePath and once in the geometry of the BoundingBox.
I too expected it to work. But as seen in the screenshot place_under_root-node.jpg, it is not giving the right displacement & rotation.
I am ensuring that the node returned (i.e. at the end of the node path) is the object and not a transform.
Is it normal for there to be an offset ? I expected it to completely bound the object after placing the sphere under its world matrix.
Use the new makeGeodesicSphere() that takes a Matrix as the first parameter.
-Paul
-Paul