Assign Vec3d to Node

12 views
Skip to first unread message

Rodrigo Dias

unread,
May 15, 2020, 1:08:58 PM5/15/20
to OpenSceneGraph Users
Hi,

I'm creating objects that must fall by gravity. So I need to assign a Vec3d, representing speed, to each Node. Is there a proper way to do it? Maybe some variable inside the Node, Geode, ShapeDrawable, etc, or some function for this kind of variable assignment? Or must I create an array outside the OSG variables?

Thanks,
Rodrigo.

Trajce Nikolov NICK

unread,
May 15, 2020, 1:23:17 PM5/15/20
to osg-...@googlegroups.com
Hi,

have a look at Node::setUserValue

--
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/2a51f5b0-9f51-45b5-acf5-17adc57f6b34%40googlegroups.com.


--
trajce nikolov nick

OpenSceneGraph Users

unread,
May 15, 2020, 4:06:09 PM5/15/20
to OpenSceneGraph Users
Hi Rodrigo,

You can use the OSG's meta object system i,e

   osg::Vec3d direction(...);
   node->setUseValue("direction", direction);


   if (node->getUseValue("direction", direction))
   {
       // do something with direction
   }

On Fri, 15 May 2020 at 18:16, OpenSceneGraph Users <osg-...@lists.openscenegraph.org> wrote:
Hi,

I'm creating objects that must fall by gravity. So I need to assign a Vec3d, representing speed, to each Node. Is there a proper way to do it? Maybe some variable inside the Node, Geode, ShapeDrawable, etc, or some function for this kind of variable assignment? Or must I create an array outside the OSG variables?

Thanks,
Rodrigo.

--
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/2a51f5b0-9f51-45b5-acf5-17adc57f6b34%40googlegroups.com.
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Rodrigo Dias

unread,
May 15, 2020, 10:58:03 PM5/15/20
to OpenSceneGraph Users
Hi Trajce,

thank you, it's working!

Rodrigo.

On Friday, May 15, 2020 at 2:23:17 PM UTC-3, Trajce Nikolov NICK wrote:
Hi,

have a look at Node::setUserValue

On Fri, May 15, 2020 at 7:09 PM Rodrigo Dias <rodri...@gmail.com> wrote:
Hi,

I'm creating objects that must fall by gravity. So I need to assign a Vec3d, representing speed, to each Node. Is there a proper way to do it? Maybe some variable inside the Node, Geode, ShapeDrawable, etc, or some function for this kind of variable assignment? Or must I create an array outside the OSG variables?

Thanks,
Rodrigo.

--
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-...@googlegroups.com.


--
trajce nikolov nick
Reply all
Reply to author
Forward
0 new messages