Spatial.getLocalTranslation() always returns 0,0,0

Hi! I’m not sure what’s up with this, so I’m hoping someone has an idea. I’m loading in a simple cube model from blender with the following standard code:

Texture grass = assetManager.loadTexture(“Textures/Grass.png”);
Spatial block = assetManager.loadModel(“Models/Grass Block.j3o”);
Material m_block = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);
m_block.setTexture(“DiffuseMap”, grass);
block.setLocalTranslation(0, -1, 0);

I can set the LocalTranslation when I create it and it positions where I want just fine, however, whenever I cast a ray to get the LocalTranslation, it is always returned at 0,0,0 no matter where it’s initially placed in the scene. Even when I create a second cube and place it next to the first one, it’s coordinates are still returned at 0,0,0 when it is visibly not.

Any thoughts? Could there be something I need to do to my cube mesh in Blender?


Also, this only happens when I cast a ray at the cube and get the results with:

Does getGeometry() not work on spatials?

In short: Try getWorldTranslation()

If a Node (a parent of other nodes, geometries) is translated, the children’s locations in relation to the node’s location do not change.

You should read this:

Thanks for the pointer. It’s all good now. It was a parent / child thing. :slight_smile: