[osg-users] osgSim::DOFTransform pivot point

Alberto Luaces aluaces at udc.es
Wed Apr 10 01:11:04 PDT 2019

"Bruce Clay" writes:

> I am working on a model viewer that has portions based on the
> osgsidebyside example.  I can load a tank model that has both
> DOFTransforms and Multiswitches then rotate the turret and elevate the
> gun and everything works correctly.
> I loaded an aircraft model with 15 DOFTransforms and no switches.  The
> transforms are for the individual control surfaces of the aircraft.
> When I try to rotate the control surfaces they seem to rotate about
> the center of the model body rather than about the "hinged" point.
> When I looked at the the translate values for all of the surfaces they
> are 0.0 so there is no information available to do the translate,
> rotate, translate sequence.  There was a mention of a pivot point in a
> previous message on this forum.  The PositionAttitudeTransform has a
> setPivot method but not the DOFTransform.
> Both models are osgb format.
> How can the pivot point be set so the control surfaces pivot about their hing?

Hi, Bruce.  A somewhat primitive technique would be to convert the file
to osgt format, and then replace your DOFTransform nodes with
PositionAttitudeTransform nodes with a text editor.  You could even set
the pivot points there as well.  You can take the osgt of the correct
model as a reference.

That should be faster than doing the same thing programmatically.


More information about the osg-users mailing list