From jMonkey user guide:
‘The Spatial class manages a link to a parent, local and world transforms, and world bounding volumes.’
Can some one please enlighten me about the difference/s between parent, local and world transforms?
It will be of great help.
All of your questions shall be answered.
Every spatial attached directly/indirectly to the rootNode has a parent Node. All local transforms are relative to the parent node, while world transforms are in global space
please consult https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:scenegraph_for_dummies for more information.
So it means that whenever I perform a geometric operation(rotation,translation,scaling etc) on an object then whatever the change in its position its wrt to its immediate parent node,and as this relationship goes up till rootnode the actual position of a object in world coordinate system is vector addition of all these parent-son relationships(hope I am clear here).
Yep, that’s the concept
As I was going through the slides for scenegraph, I came across following confusion:
Scenegraph for dummies states:
On slide 9, spatial is rotated around z axis by 90 degree.
Now as this rotation must be abt parent node(origin here), so final position must be like this:
final pos O | O
| / initial pos
But as per the figure in slide 10, spatial seems to have undergone rotation abt its own axis rather than wrt its parent node, which lies at origin.
Please helpme in understanding.
in my last post figure got arranged wrongly.
What I mean is that spatial must have undergone a 90 degree rotation abt z axis of parent node but slide 10 shows as if spatial has undergone a rotation of 90 degree about its own axis.
Yes, it rotated about its own axis in that example. I’m not sure what you’re asking about the parent node…
What I am confused about is that in slide 7,where spatial is at zero location and rotation, spatial is moved using
So new position of spatial is to point 1,1,0 wrt zero whic. So movement happens about zero which is totally as expected.
Now if I perform rotation abt z axis using spatial.rotate(0,0,FastMath.HALF_PI), then this rotation must also be abt zero rather than spatial’s own axis, and these are two different rotations leading to two different positions in space. Its more like earth’s movement about sun and spinning on its own axis. What is given in slide 10 is like earth rotating on its own axis while I think it must be like revolution about sun.
So if u rotate point (1,1,0) about z axis then it must put point at (-1,1,0). But ths is not happening in slide 10. It just rotates the point on its own axis.
Ah I see what you are saying… In order to get the Sun/Earth effect you would need to rotate the parent
OK.Rotating a node will rotate all of its child nodes too.
But my confusion still persists.
Before rotation spatil is at 1,1,0. So after rotation it must be at -1,1,0 as rotation must be abt zero(just like prior translation).
Rotating a coordinate system doesn’t change the positions of the points within it.
Have you done some experimentation with this? I think it will become clearer if you just stick a few boxes in a scene and start playing with them
‘Rotating a coordinate system doesn’t change the positions of the points within it.’
I think that holds true for every type of geometrical operation , like translation or scaling as we are doing it for entire system then and hence relative positions remain same.
But here we are not rotating the coord system, we are rather rotating one of the points(1,1,0 in this case).
I did rotate some boxes and if I remember correctly I was able to get what I expected.But then I read this slide and got confused.
A steering wheel is a child of a car and translated relative to the car’s origin.
The car has a translation in the world relative to world origin.
If you rotate the car, it rotates about its own origin.
If you rotate the steering wheel, it rotates about its own origin.
If you move the car then the steering wheel also moves relative to the car.
If you rotate the car then the steering wheel also moves (and rotates) relative to the car.
If you rotate the steering wheel, it does not move.
Read the scene graph for dummies over and over until it isn’t confusing.
What I meant by that was that every hierarchical level within the scene is its own coordinate system.
so if I want to rotate a spatial about some arbitrary axis then how can I do it?
So if I want to rotate a spatial about some arbitrary axis then how can I do it?Apart from ‘rotating parent node’ approach.
You mean about an arbitrary origin?
The easiest way is to create a parent for it at that location and rotate the parent.
Describe more specifically what you are trying to do. Because my first instinct was to ask “Why do you want to even do that?!?”