Rotating a dynamicphysicsnode

I'm trying to create a simple "reset" function for my car demo, i.e. when it's flipped on its roof I want to be able to flip it back on its wheels.



I've managed to move it up 2 units like this:



Car is a Node, carmodel is the DynamicPhysicsNode, attached to Node.

car.getLocalTranslation().set(car.getLocalTranslation().add(0,2,0));
car.carmodel.clearDynamics();



This works fine, but doing the same thing with localrotation sends the car to the moon  :oops:


Matrix3f rotMatrix = new Matrix3f();
rotMatrix.fromAngleAxis(FastMath.PI/2, new Vector3f(1,0,0)); //x-axis
         
car.setLocalRotation(rotMatrix);
car.carmodel.clearDynamics();



Does anybody know how to rotate the car back up again?

You need to move the wheels (and probably other geoms) as well. Have a look into the AdvancedVehicle stuff - it has a reset action as well.

Hmm ok, i'll take a look at that. :slight_smile:



But now i'm curious, why does a translation work fine (no glitches at all) and a rotation doesn't?

When you move the chassis up a little bit the wheels just flip up as well. But if you rotate by a larger angle (e.g. 180