localRotation issue

Hi everybody! I've got a little problem with a box! XD

Here we go. I have a box attached to a node (which has its own local rotation); what I want to do is to set new dimension for the box (without modify its rotation), so I've tried this:

box.updateGeometry(Vector3f.ZERO,box_X, box_Y, box_Z);

The problem is that with this line of code I get my box rotated.
I've make it works by adding this line of code:


For what I have to do I would like to avoid this operation. Is there I way to set new dimension for the box without modify its rotation???

PS: Sorry for my bad English!!  :D

Can you post an example to reproduce the problem?

In my example the Box didn't loos the rotation when using updateGeometry().

Hmm…what exactly do you mean with setting new dimension? Do you mean scaling? If yes try


Don't know if it was that what you wanted to! If not ignore it :smiley:

what exactly do you mean with setting new dimension? Do you mean scaling?

For setting new dimension I mean that if I have a box with size x=2, y=6, z=0.8, what I want to do is to change those size for example to x=1, y=5.3f, z=2.4f, and sometimes even change the center of the box. I've used updateGeometry because seemed easier than setLocalScale, but maybe I'm wrong.

Other suggestions?  :D

hmm,…actually I didn't know that there is a method updateGeometry(…) but it seems to have a sideeffect on your node that you don't want to happen. So I suggest you should use setLocalScale for setting the dimensions of the box and setLocalTranslation for "setting the center".

Well now I've changed the code and make it work with localTranslation and localScale, but it was something like this:

collider.setLocalTranslation(...); // collider is the node where my box is attached to
collider.getBox().updateGeometry(Vector3f.ZERO, box_X, box_Y, box_Z);  //grab the box and modify its dimensions