Can a Spatial have 2 different parent Nodes?

i need a spatial to have 2 parent nodes…

basically i require the spatial to turn about a pivot, but the spatial must be able to turn both left and right.

so my approach was to attach 2 separate nodes on the left and right side respectively of the spatial, and rotate the nodes accordingly whenever i need it to turn.

will this work?

You can’t attach a spatial into 2 different parent node in JME as far as I known …



Cause in the core code , it’s detached from the old parent and attach to the new one … But take a look at how Control work … It can do the job you need , change one spatial parent in some situation …<= That’s how my Layer Manager which control the visibility of objects work …



Happy coding!

Sounds like what you need is to combine two distinct rotations.



https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:math_for_dummies



Skip to slide 32 where rotations are explained.

how do i place the point of rotation at a location that is not the y, x, or z axis?

for example i need an up axis to be at the point (4, 0, 6) .



right now what i have is:



quat.fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_Y);

vectorA = girl3.getLocalTranslation();

girl3.setLocalTranslation(quat.mult(vectorA));



but if i replace Vector3f.UNIT_Y with the vector (4,0,6), it will rotate about the axis which that vector forms!



kindly advise… thanks

Please see this page:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:scenegraph_for_dummies