I imported my models from Blender in JME3 (character, sword and shield).
Right now, I want to attach the shield in the left hand and the sword in the right hand of the character.
I followed the instructions from TestOgreAnim.java but the transform of the objects relative to the character is wrong. What can be wrong?
Maybe were the bones created wrong in Blender? Or I should mirror the position of the spatial (sword and shield) relative to the character-node inside the JME? I cannot see the source model of the Ogre, used in JME3-examples to determine the best practices.
Well, for starters at least you should switch to GLTF and not use the Ogre XML. That is deprecated pretty much. That might even already solve the problem.
I use GLTF. I talked not about the file format but about the code from the example. I have also tried to add the simple red box from the JME-example. And it appears also in same place as the sword. This is the example code:
Box b = new Box(.25f, 3f, .25f);
Geometry item = new Geometry("Item", b);
item.move(0, 1.5f, 0);
item.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
Node n = skinningControl.getAttachmentsNode("hand.right");
n.attachChild(item);
I’m watching this video and it seems the sword makes the rotation right, but the translation must be from the left to the right (on the picture), but the sword makes the translation from backward to forward.
I have nothing strange in the code, but I have tried to edit the character model in the SceneComposer and highlighted the low level mesh in the SceneExplorer. And it shows me something strange:
When exporting the GLTF file from Blender, did you click the “y up” checkbox?
Edit: also make sure you “apply transforms” on your model. Hint: so far all of my model-related suggestions have been “things to fix in Blender”.
I also think it is the export problem, but I can not determine how to fix it. I have played with this check-box. It rotates the model but the blue mesh is also rotated relative to the visible model. The modifiers are applied. It could be intuitive right if I could rotate the low level mesh around 180 grad and the parent node around -90, but it is not successfully in the SceneComposer window.