Hi,
Using quad meshes to represent sprites, I’m attaching different pieces to the actor body to compose it.
When attaching a quad mesh to the parent body, the bone is not following the rotation of the parent.
Am I doing something wrong here?
Hi,
Using quad meshes to represent sprites, I’m attaching different pieces to the actor body to compose it.
When attaching a quad mesh to the parent body, the bone is not following the rotation of the parent.
Am I doing something wrong here?
https://playground.babylonjs.com/#YM8MSS#3 You forgot to link bone - mesh. Not sure if it should rotate like that?
N.B. I could have sworn that you can set it up in a way where you can transform the bones directly.
N.B.2: Keep in mind that there is “vertex weights” which you are not dealingh with here at all. So there probably is some more work to do.
Now it rotates, but… the rotation is not according to the parent.
Hello
I think your problem comes from the fact that you have no root bone.
Try this :
const boneROOT = new BABYLON.Bone('bone', quadMesh1.skeleton, null, BABYLON.Matrix.Identity());
const bone = new BABYLON.Bone('bone', quadMesh1.skeleton, boneROOT, BABYLON.Matrix.Identity());
That is!! Thanks so much!
Why? The original PG does have a root bone (see Inspector).
Might there be a bug if the skeleton only has a single bone? attachToBone looks innocent though
Maybe here: if attachToBone was called, this path is taken in computeWorldMatrix. But then I get lost because bone._finalMatrix is never updated
Yes, but here @Khanon wants to move a bone and attach a mesh to it, and in that case it should not be the root bone, I guess. I don’t have the exact answer to the “why ?” but I just notice that either BabylonJS or Blender, it’s always like so : root bone, and then you attach some transform bones to it . I guess it’s a matter of hierarchy organisation / convention or something like that
For some reason this is not working in my engine
I’m investigating but the structure seems to be the same than the PG.
PS: Ok, I found it, the problem is using billboardMode in the hat mesh, which is attached to the bone.
@Evgeni_Popov some idea if this is the desired behaviour or a bug?
I think it’s the expected behavior, but you can try to set TransformNode.BillboardUseParentOrientation = true
and see if it fixes it.
Yes, that works, anyway I’m unsetting the billboardMode for the child.