Hi,
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.
[java]
Quaternion r = new Quaternion();
r.fromAngles(0, unit.turretOrientation, 0);
r = turretBone.getWorldBindRotation().mult®;
turretBone.setUserControl(true);
turretBone.setUserTransforms(Vector3f.ZERO, r, Vector3f.UNIT_XYZ);
[/java]
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.setUserControl(true);
turretBone.setUserTransformsWorld(Vector3f.ZERO, r);
skeleton.updateWorldVectors();
[/java]
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.
Ben