I have a model instance of a character, and a model instance of a sword weapon. THe character has a node on his right hand so he can “carry” the sword. Right now I use this code so the sword’s transform follows that of the node.
weaponModelInstance.transform.set(modelInstance.transform).mul(weaponAttachmentNode.globalTransform);
weaponModelInstance.transform.rotate(Vector3.Z, -90); // adjustment for blender coordinates
world.modelBatch.render(weaponModelInstance, world.environment);
this works, except that the model instance gets scaled to the scale of the node, which i do not want, i want the weapon to keep its scale. I’ve tried doing the following code to fix this but I end up getting weird (and wrong) rotations for the sword
weaponModelInstance.transform.set(modelInstance.transform).mul(weaponAttachmentNode.globalTransform);
weaponModelInstance.transform.set(
weaponModelInstance.transform.getTranslation(new Vector3()),
weaponModelInstance.transform.getRotation(new Quaternion()),
new Vector3(1, 1, 1)
);
weaponModelInstance.transform.rotate(Vector3.Z, -90);
world.modelBatch.render(weaponModelInstance, world.environment);
do anyone know how to properly copy the world translation and rotation from the node, but not its scale?