Hi
I have a strange problem which seems very simple. Somewhere in my project I call a worldToLocal function (for a mouse pick):
[java]containerNode.worldToLocal(closest.getContactPoint(), store);[/java]
This creates some sort of offset for new objects that are initialized. If I instantiate a new cube for example, it is not instantiated at the origin, but at the previous ‘store’ variable. Even if i explicitly set the local translation, it doesn’t work.
[java]private void testCube(){
Box boxshape1 = new Box(1f,1f,1f);
Geometry cube = new Geometry(“My Textured Box”, boxshape1);
Material mat_stl = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
Texture tex_ml = assetManager.loadTexture(“Textures/circle.png”);
mat_stl.setTexture(“m_ColorMap”, tex_ml);
cube.setMaterial(mat_stl);
rootNode.attachChild(cube);
} [/java]
Why does this happen? These pieces of code should have no relation what soever…
Maybe your “store” variable points to some built-in static Vector like Vector3f.ZERO? Then you’d change that and everything using Vector3f.ZERO would use that vector instead.
1 Like
That was it, can’t believe I didn’t notice that. Thank you!