Rotating models

Hello friends, i’m working with the example lessons included in jme. I’ve changed the model of the bike and put a car. I learned that i have to name the wheels (inside the model) and get them from the model in order to make them spin. The problem that I have is that when i make them rotate, they rotate in the center of the parent model and not in their center itself.



How can i do to make them rotate in their place?



//Rotation code



rotQuad.fromAngleAxis(angle, wheelAxis);



w1.setLocalRotation(rotQuad); // wheel #1

w2.setLocalRotation(rotQuad); // wheel #2

w3.setLocalRotation(rotQuad);

w4.setLocalRotation(rotQuad);



Picture of the orbital spinning wheels XD



It's because the center of the car, is the center/pivot point of the wheels.

Open the model in your 3d editor, and move the center/pivot point of the wheel to the center of the wheel and export it. You only need one wheel, that you duplicate, and translate to the correct positions in your app.