Moving a cube with global coordinates

Hello Community,


// Position is a Vector3f(10, 0, -100);

Box b = new Box(position, w/2, h/2, 0);

geom = new Geometry(“PlayerShape_”+id, b);

Material mat = new Material(parent.getAssetManager(), “Common/MatDefs/Misc/Unshaded.j3md”);

mat.setColor(“Color”, ColorRGBA.White);




I think I have just a beginner-problem :slight_smile: After I created the cube this way I want to move him to other coordinates with my position-vector. This means position gets an new value and then I need something like geom.setCenter(position); I’m sorry but I can’t find a suitable method for this.

Thank you for your help and sorry for my bad English (currently I’m learning this language)

Greets Mike

I am not sure what you want, but you can look at this if you haven’t: So if you wanna position something, that is called a translation.

by my-position vector do you mean position of the player ? if so you would have to setLocalTranslation of the box in the update loop

Ahh ok, thanks I get it