Question about coordinate systems

I’m writing a presentation comparing jME and Xith3D and while I could gather information about Xith3D with regards to putting together a related hierarchical scene structure I haven’t been able to find similar for jME.

So here’s the question. The scenario is drawing a simple:

sun->planet->moons

scenario. So I create a Node and attach a sphere for the sun. I create a Node and attach a sphere for the planet. I create a set of Node(s) and attach a sphere for each of the moons. I then parent them up properly to maintain the hierarcy. The question I have then is how do I specify position relative to the respective parent Node for the planet and the moons?

The sun is sitting in the middle of the graph. The planet is going to be offset from the center and I set a Vector3f() for its position when creating the sphere, but what coordinate system is that relative to?

Local settings affect a node respective to it’s parent. setLocalTranslation, setLocalRotation, setLocalScale.


sun.attachChild(planet);
planet.setLocalTranslation(100, 0,0);
planet.attachChild(moon);
moon.setLocalTranslation(10, 0,0);

//sun's actual world coordinates: 0,0,0
//planet's actual world coordinates: 100, 0, 0
//moon's actual world coordinates: 110, 0, 0

[quote]Local settings affect a node respective to it’s parent. setLocalTranslation, setLocalRotation, setLocalScale.


sun.attachChild(planet);
planet.setLocalTranslation(100, 0,0);
planet.attachChild(moon);
moon.setLocalTranslation(10, 0,0);

//sun's actual world coordinates: 0,0,0
//planet's actual world coordinates: 100, 0, 0
//moon's actual world coordinates: 110, 0, 0

[/quote]
Great thanks. Was surprised to not see a “classic” hierarchical animation example in the docs.

there’s an example of circular animation in jmetest.TutorialGuide.HelloAnimation.
It rotates a point light and a box around a sphere using a SpatialTransformer.

there is also “jmetest.renderer.TestSceneGraph” that does exactly what you are looking for :slight_smile:

DP

[quote]there’s an example of circular animation in jmetest.TutorialGuide.HelloAnimation.
It rotates a point light and a box around a sphere using a SpatialTransformer.
[/quote]
Rotation with the SpatialTransformer is far from simple unfortunately and I’m actually trying to get my head around the pivots and Quaternions of that example to make sense of them. If you want a simple “Rotate around your parent at this rate using this rotation matrix” there isn’t anything simple.

We’ve got “simpler utility classes” as an item of business on the .9 slate. I’ll look at making something like what you talk about one of these utils.