<div dir="ltr">Sebastian, I've used the nodevisitor to find the node by name, the node just happens to be a osg::group. Could you explain what you mean by "replace them with a DOF-Transform"? I'm optimistic that you mean programmatically. My current approach is to replace it manually in the osgt file.<div><br></div><div>Thanks</div><div>Jeremy<br><br>On Thursday, April 16, 2020 at 7:14:18 AM UTC-4, OpenSceneGraph Users wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div lang="DE" link="blue" vlink="purple"><div><p class="MsoNormal"><span>Hi Jeremy, </span></p><p class="MsoNormal"><span> </span></p><p class="MsoNormal"><span lang="EN-US">As your geometry-parts are usually under a transform /group you can use a NodeVisitor to collect those (Find the nodes by name) and replace them with a DOF-Transform. </span></p><p class="MsoNormal"><span lang="EN-US">You could of course also mess with the osgt-files, but that would be a last resort. </span></p><p class="MsoNormal"><span lang="EN-US"> </span></p><p class="MsoNormal"><span lang="EN-US">Cheers</span></p><p class="MsoNormal"><span lang="EN-US">Sebastian </span></p><p class="MsoNormal"><span lang="EN-US"> </span></p><p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> osg-users <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="8-r2EA1JAgAJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">osg-user...@lists.<wbr>openscenegraph.org</a>> <b>On Behalf Of </b>OpenSceneGraph Users<br><b>Sent:</b> Mittwoch, 15. April 2020 21:54<br><b>To:</b> OpenSceneGraph Users <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="8-r2EA1JAgAJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">osg-...@googlegroups.com</a>><br><b>Subject:</b> [osg-users] Edit 3D (osgt) model to add DOFTransform and perform "node" rotation</span></p><p class="MsoNormal"><span lang="EN-US"> </span></p><div><p><span lang="EN-US" style="color:black">First off, I hope everyone is staying sane and healthy during this pandemic.</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="color:black"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="color:black">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.</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="color:black"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="color:black">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:</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="text-indent:36.0pt;background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="color:black">FindNamedNodeVisitor fnnv("turret");</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="text-indent:36.0pt;background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="color:black">scene->accept(fnnv);</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="text-indent:36.0pt;background-image:initial;background-position:initial;background-repeat:initial"><span style="color:black">osg::ref_ptr<osgSim::<wbr>DOFTransform> dofTrans = new osgSim::DOFTransform();</span><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="text-indent:36.0pt;background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="color:black">dofTrans = dynamic_cast<osgSim::<wbr>DOFTransform*>(fnnv.<wbr>getFoundNode()->asTransform())<wbr>;</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="text-indent:36.0pt;background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="color:black">if(dofTrans != NULL)</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="color:black;border:none windowtext 1.0pt;padding:0cm">                              <wbr>  </span><span lang="EN-US" style="color:black">//manipulate (rotate)<span style="border:none windowtext 1.0pt;padding:0cm">   </span></span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="color:black"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="color:black">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.</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="color:black"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="color:black">I’m looking for any guidance/suggestions/lessons learned on how to properly do this.</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"> </span></p><p style="background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="color:black;border:none windowtext 1.0pt;padding:0cm">Thanks</span><span lang="EN-US" style="color:black"> in advance</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="color:black"> </span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p><p style="background-image:initial;background-position:initial;background-repeat:initial"><span lang="EN-US" style="color:black">Jeremy</span><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"></span></p></div><p class="MsoNormal"><span lang="EN-US">-- <br>You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.<br>To unsubscribe from this group and stop receiving emails from it, send an email to </span><a href="javascript:" target="_blank" gdf-obfuscated-mailto="8-r2EA1JAgAJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;"><span lang="EN-US">osg-users+unsubscribe@<wbr>googlegroups.com</span></a><span lang="EN-US">.<br>To view this discussion on the web visit </span><a href="https://groups.google.com/d/msgid/osg-users/cbb4b132-24a7-4e75-b10f-7474c1a99378%40googlegroups.com?utm_medium=email&utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/msgid/osg-users/cbb4b132-24a7-4e75-b10f-7474c1a99378%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter';return true;" onclick="this.href='https://groups.google.com/d/msgid/osg-users/cbb4b132-24a7-4e75-b10f-7474c1a99378%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter';return true;"><span lang="EN-US">https://groups.google.com/d/<wbr>msgid/osg-users/cbb4b132-24a7-<wbr>4e75-b10f-7474c1a99378%<wbr>40googlegroups.com</span></a><span lang="EN-US">.</span></p></div></div></blockquote></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:osg-users+unsubscribe@googlegroups.com">osg-users+unsubscribe@googlegroups.com</a>.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/osg-users/5fcaac09-655d-44f9-bf97-47eee2a19b97%40googlegroups.com?utm_medium=email&utm_source=footer">https://groups.google.com/d/msgid/osg-users/5fcaac09-655d-44f9-bf97-47eee2a19b97%40googlegroups.com</a>.<br />