<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=DE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Hi, <o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>you’re on the right track. Issue 1 stems from the fact, that you are not removing the original group or at least the childs you’re re-parenting (which still has references to your nodes).<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>Concerning issue 2. If the parent is a transform, you obviously need to take this into account. PAT has a setPivotPoint IIRC, but another option is to structure your scenegraph as follows:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>Group -> OrginalTransform/Parent -> YourNewPAT -> Geometry1 … GeometryN<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>So leave the transform an put your PAT inbetween. That should solve the offset. If you’re still struggeling with this, maybe supply a minimal osgt.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>Cheers <br>Sebastian <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> osg-users <osg-users-bounces@lists.openscenegraph.org> <b>On Behalf Of </b>OpenSceneGraph Users<br><b>Sent:</b> Samstag, 18. April 2020 01:38<br><b>To:</b> OpenSceneGraph Users <osg-users@googlegroups.com><br><b>Subject:</b> Re: [osg-users] Edit 3D (osgt) model to add DOFTransform and perform "node" rotation<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>Sebastian</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>Thank you for your patience and guidance. Programmatically definitely makes sense and I did look into that a short while back. I was initially looking at PositionAttitudeTransform. Now revisiting that approach, I understand why I started to look in another direction. Here is the dilemma I've come across. All is good until I try to assign a parent to the Transform </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>hive::display::FindNamedNodeVisitor fnnv("Main_Hub");</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>scene->accept(fnnv);</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>osg::ref_ptr <osg::PositionAttitudeTransform> autoTrans = new osg:: PositionAttitudeTransform();</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>//puts node and all children under transform</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>autoTrans->addChild(fnnv.getFoundNode());</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>//set the parent (this doesn’t seem completely right to me, but may be)</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>fnnv.getFoundNode()->getParent(0)->addChild(autoTrans);</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>issue 1) at this point it appears to create a duplicate object (node and children) of the “Main_Hub” group; </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>issue 2) when I attempt rotation of the object it seems to be around the origin of the model instead of the previous “pivot pilot”</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>I seem to be missing how to squeeze that transform between the parent and child appropriately.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p> </o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>Jeremy</span><o:p></o:p></p><p class=MsoNormal><br>On Thursday, April 16, 2020 at 9:41:55 AM UTC-4, OpenSceneGraph Users wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Hi Jeremy, <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US>Yes programmatically. You simply create a  Transform, DOFTransform, whatever and set all the children of the original Group as childs of the new one (transforms, as you surely know are groups too).</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US>Lastly you want to want to set the parent as well. I haven’t used OSG in a while, but this pattern for sure works. </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US>If you have more questions fell free to ask.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US>Cheers </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US>Sebastian </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span lang=EN-US>From:</span></b><span lang=EN-US> osg-users <<a href="javascript:" target="_blank">osg-user...@lists.openscenegraph.org</a>> <b>On Behalf Of </b>OpenSceneGraph Users<br><b>Sent:</b> Donnerstag, 16. April 2020 14:36<br><b>To:</b> OpenSceneGraph Users <<a href="javascript:" target="_blank">osg-...@googlegroups.com</a>><br><b>Subject:</b> Re: [osg-users] Edit 3D (osgt) model to add DOFTransform and perform "node" rotation</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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.<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Thanks<o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Jeremy<br><br>On Thursday, April 16, 2020 at 7:14:18 AM UTC-4, OpenSceneGraph Users wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Hi Jeremy, <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><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><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US>You could of course also mess with the osgt-files, but that would be a last resort. </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US>Cheers</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US>Sebastian </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span lang=EN-US>From:</span></b><span lang=EN-US> osg-users <<a href="mailto:osg-user...@lists.openscenegraph.org">osg-user...@lists.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="mailto:osg-...@googlegroups.com">osg-...@googlegroups.com</a>><br><b>Subject:</b> [osg-users] Edit 3D (osgt) model to add DOFTransform and perform "node" rotation</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US> </span><o:p></o:p></p><div><p><span lang=EN-US style='color:black'>First off, I hope everyone is staying sane and healthy during this pandemic.</span><o:p></o:p></p><p style='background-image:initial;background-position:initial;background-repeat:initial'><span lang=EN-US style='color:black'> </span><o:p></o:p></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><o:p></o:p></p><p style='background-image:initial;background-position:initial;background-repeat:initial'><span lang=EN-US style='color:black'> </span><o:p></o:p></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><o:p></o:p></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><o:p></o:p></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><o:p></o:p></p><p style='text-indent:36.0pt;background-image:initial;background-position:initial;background-repeat:initial'><span style='color:black'>osg::ref_ptr<osgSim::DOFTransform> dofTrans = new osgSim::DOFTransform();</span><o:p></o:p></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::DOFTransform*>(fnnv.getFoundNode()->asTransform());</span><o:p></o:p></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><o:p></o:p></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'>                                </span><span lang=EN-US style='color:black'>//manipulate (rotate)<span style='border:none windowtext 1.0pt;padding:0cm'>   </span></span><o:p></o:p></p><p style='background-image:initial;background-position:initial;background-repeat:initial'><span lang=EN-US style='color:black'> </span><o:p></o:p></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><o:p></o:p></p><p style='background-image:initial;background-position:initial;background-repeat:initial'><span lang=EN-US style='color:black'> </span><o:p></o:p></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><o:p></o:p></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><o:p></o:p></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><o:p></o:p></p><p style='background-image:initial;background-position:initial;background-repeat:initial'><span lang=EN-US style='color:black'> </span><o:p></o:p></p><p style='background-image:initial;background-position:initial;background-repeat:initial'><span lang=EN-US style='color:black'>Jeremy</span><o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><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 <a href="mailto:osg-users+unsubscribe@googlegroups.com">osg-users+unsubscribe@googlegroups.com</a>.<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"><span lang=EN-US>https://groups.google.com/d/msgid/osg-users/cbb4b132-24a7-4e75-b10f-7474c1a99378%40googlegroups.com</span></a><span lang=EN-US>.</span><o:p></o:p></p></div></div></blockquote></div></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>-- <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="javascript:" target="_blank">osg-...@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" target="_blank">https://groups.google.com/d/msgid/osg-users/5fcaac09-655d-44f9-bf97-47eee2a19b97%40googlegroups.com</a>.<o:p></o:p></p></div></div></blockquote></div><p class=MsoNormal>-- <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/4fe387e2-619f-48b5-8b8d-d99b1c28198d%40googlegroups.com?utm_medium=email&utm_source=footer">https://groups.google.com/d/msgid/osg-users/4fe387e2-619f-48b5-8b8d-d99b1c28198d%40googlegroups.com</a>.<o:p></o:p></p></div></body></html>