Can't figure out how to set transforms on a bone


I’m trying to rotate the turret of my tanks in a RTS game. I specificaly need to rotate a bone of the model. To do that, I tried two approches : one with the setUserTransformsWorld() and another with setUserTransforms(). Both failed.

Quaternion r = new Quaternion();
r.fromAngles(0, unit.turretOrientation, 0);
r = turretBone.getWorldBindRotation().mult®;

turretBone.setUserTransforms(Vector3f.ZERO, r, Vector3f.UNIT_XYZ);
In this case, a rotation applies but not in the axes I need. I tried different ways, different axes… Is there something wrong with this approach?

[java]Quaternion r = new Quaternion();
r.fromAngles(0, unit.turretOrientation, 0);

turretBone.setUserTransformsWorld(Vector3f.ZERO, r);
In this case, I never obtain any result. The turret is fixed at the same rotation on the tank, whatever is the orientation applied.

Can’t understand what’s wrong in both approches. Thanks in advance for your time.


I guess this is a model from blender? Click the “show axes” on the skeleton in Blender, it will show you the coordinate system of the bone. Maybe it’s not aligned how you think. If I remember, you just need to use SetUserControl(true);

You were right, I made a confusion between world transform and local transform, which depends on my bone’s parent transform.

Thanks for the advise.