[osg-users] Scale model node to specific size

624 views
Skip to first unread message

Zev Lix

unread,
Sep 2, 2013, 7:41:20 PM9/2/13
to osg-...@lists.openscenegraph.org
Hi,
I wonder if there is a way of scaling a model to a specific size? So if i have two models that have different sizes when loaded into osg, i want to scale these two models so that they have the same lenght or width.

Example if i have two models of cars they should both have X length in my osg application regardless of how big they were when created in some model program.

I know i could just create the models in the right size to start with. but this is a problem when adding models made by other people.

Thank you!

Cheers,
Zev

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=56075#56075





_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Alberto Luaces

unread,
Sep 12, 2013, 8:04:52 AM9/12/13
to osg-...@lists.openscenegraph.org
"Zev Lix" writes:

> Hi, I wonder if there is a way of scaling a model to a specific size?
> So if i have two models that have different sizes when loaded into
> osg, i want to scale these two models so that they have the same
> lenght or width.
>
> Example if i have two models of cars they should both have X length in
> my osg application regardless of how big they were when created in
> some model program.
>
> I know i could just create the models in the right size to start
> with. but this is a problem when adding models made by other people.

Hi Zev, you can get the total dimensions with the osg::BoundingBox of
the object. Later you can scale it to the right size placing it under a
osg::MatrixTransform node with a scale matrix.

--
Alberto

Mahadev Kurkundi

unread,
Feb 11, 2020, 3:37:56 AM2/11/20
to OpenSceneGraph Users
Thanks Alberto. The answer helped me to resize the model as required.
Reply all
Reply to author
Forward
0 new messages