On 7/2/2011 12:49 PM, David Cofer wrote:
Hi,
This may be easy and I am just not seeing how to do it at the moment. I have a
scene graph and I would like to add an object to an arbitrary node on the
graph, but I want to make sure that the new node is positioned at the world
coordinates that I have specified. So I need to calculate the local transform
that would be needed when added to a node that would give the new node that
world coordinates. This is obviously not a simple matter of finding the
difference between the world coords and the parent object, because there could
be any number of rotations in the scene graph to that point. I was wondering if
anyone knew if there was a simple way to do this before I go digging out my
matrix math books to try and figure this out.
1) This isn't what you'd typically do in a scene graph. For something like this,
you'd usually attach the node to a top-level parent that has no other parent
transforms, giving you complete control over the position. In other words, what
you're attempting somewhat abuses the concept of a scene graph.
2) Nonetheless, I agree with you there are cases where you might want to do what
you describe (physics, for example). For this reason, I've created a custom
Transform node, AbsoluteModelTransform, which lives in the external osgWorks
project (osgworks.googlecode.com). It should do exactly what you want.
I hope that helps,
-Paul
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org