[osg-users] Edit 3D (osgt) model to add DOFTransform and perform "node" rotation
OpenSceneGraph Users
osg-users at lists.openscenegraph.org
Thu Apr 16 05:25:20 PDT 2020
Thanks Robert, I thought the structure may be a bit much but here is the
high level breakdown:
osg::MatrixTransform
-osg::Group
--osg::StateSet
-osg::Group
--osg::Geode
--osg::Geode
--osg::Geode
--osg::Geode
--osg::Geode
--osg::Group
--osg::Geode
--osg::Group
--osg::Geode
--osg::Geode
--osg::Geode
--osg::Group
--osg::Geode
--osg::Geode
--osg::Geode
--osg::Geode
--osg::Geode
--osg::Geode
--osg::Group
--osg::Group
--osg::Group
--osg::Group
--osg::Geode
--osg::Geode
--osg::Geode
--osg::Geode
--osg::Group
---osg::Group "Main_Hub"
----osg::Geode
-----osg::Geometry
------osg::StateSet
-------osg::DrawArray
--------osg::Vec3Array
--osg::Group "Tail_Hub"
Again I'm looking to access the osg::Group "Main_Hub" get Transform
functionality from it.
Jeremy
On Thursday, April 16, 2020 at 2:39:10 AM UTC-4, OpenSceneGraph Users wrote:
>
> Hi Jeremy,
>
> The DOFTransform example you've come across only works for a
> osgSIM::DOFTransform because it was created with this type of
> DOFTransform. THE DOFTransform is written specifically for OpenFlight
> support so only created by the the OSG .flt loader, most other models will
> use other types of osg::Transform nodes such as osg::MatrixTransform or
> osg::PositionAttitutudeTransform.
>
> You haven't provide any details about the scene graphs structure of your
> helicopter.osgt so we can't tell what to look for, the model might not even
> have any Transform node in it, in which case you'll need to add one.
>
> Robert.
>
>
>
> On Wed, 15 Apr 2020 at 21:55, OpenSceneGraph Users <
> osg-... at lists.openscenegraph.org <javascript:>> wrote:
>
>> First off, I hope everyone is staying sane and healthy during this
>> pandemic.
>>
>>
>>
>> I’m working with a collection of 3D models that have come from a variety
>> of different source but are now all in osgb format. For several of the
>> models I’d like to grab a “node” and apply rotation.
>>
>>
>>
>> As I’m working through my understanding of the approach, I’ve created a
>> simple application that loads the model, traverses the scene, returns a
>> pointer to the “node”, casts to a DOFTransform and manipulate the “node”
>> (DOFTransform). Snippet:
>>
>> FindNamedNodeVisitor fnnv("turret");
>>
>> scene->accept(fnnv);
>>
>> osg::ref_ptr<osgSim::DOFTransform> dofTrans = new osgSim::DOFTransform();
>>
>> dofTrans =
>> dynamic_cast<osgSim::DOFTransform*>(fnnv.getFoundNode()->asTransform());
>>
>> if(dofTrans != NULL)
>>
>> //manipulate (rotate)
>>
>>
>>
>> This approach works for the tank.osg model. Now I’m trying to apply this
>> approach to a different model (helicopter for example). When I access the
>> “node” of interest, “Main_Hub” which is an osg::Group I obviously can’t
>> cast that to a osgSim::DOFTransform. I’m trying to get an understand of how
>> I can change the model, now in osgt (readable) format, to a structure that
>> can be used. I’ve been using the tank.osg as a guide and attempted to
>> recreate a similar structure in the helicopter.osgt. I’m trying to take
>> logical stabs in the dark, in the helicopter model I’ve attempted to simply
>> renamed the “node” of interest from an osg::Group to osgSim::DOFTransform.
>> The model still displays correctly, but the cast to osgSim::DOFTransform
>> returns NULL. I thought there may be some required variables at are needed
>> as part of the osgSim::DOFTransform structure, so I began adding
>> currentHPR, currentTranslate, and currentScale and continued to add more
>> bringing it in line with the tank.osg example. Through all the attempts I
>> still getting NULL when casting.
>>
>>
>>
>> I’m looking for any guidance/suggestions/lessons learned on how to
>> properly do this.
>>
>>
>> Thanks in advance
>>
>>
>>
>> Jeremy
>>
>> --
>> 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-... at googlegroups.com <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/osg-users/cbb4b132-24a7-4e75-b10f-7474c1a99378%40googlegroups.com
>> <https://groups.google.com/d/msgid/osg-users/cbb4b132-24a7-4e75-b10f-7474c1a99378%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> _______________________________________________
>> osg-users mailing list
>> osg-... at lists.openscenegraph.org <javascript:>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
--
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+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/ea7ac52d-bf9f-42bf-8b1c-a90bac81017b%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200416/f854eb8c/attachment.html>
More information about the osg-users
mailing list