How to scale/rotate/move an asset in OpenSceneGraph

32 views
Skip to first unread message

Luca Costantino

unread,
Feb 11, 2020, 11:29:57 AM2/11/20
to OpenSceneGraph Users

I am totally new with OpenSceneGraph

I can open and save an OSG asset. I need to do some simple transformations on it, like dimension scaling/rotation/translation.

It seems a pretty easy task, anyway I can't find any quick documentation :/

osg::ref_ptr<osg::Node> rectangle = osgDB::readNodeFile("../../inputs/Rectangle.osg");

// define simple transformation matrix
// apply  simple trnasformation matrix

osgDB::writeNodeFile(*rectangle, "../../outputs/saved.osg");

Any hint?

Armin Samii

unread,
Feb 11, 2020, 11:38:14 AM2/11/20
to osg-...@googlegroups.com
Check out the examples directory.
One example: https://github.com/openscenegraph/OpenSceneGraph/blob/master/examples/osganimate/osganimate.cpp#L247
1. Create a MatrixTransform
2. Add your rectangle as a child of that transform
3. Save the MatrixTransform node

--
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/a6df11c6-2805-44e4-af15-62aa8a77dabb%40googlegroups.com.

Luca Costantino

unread,
Feb 12, 2020, 4:59:36 AM2/12/20
to osg-...@googlegroups.com
That helped a lot.

Thanks
Regards
Luca

Reply all
Reply to author
Forward
0 new messages