Problems skinning mesh

Trying to get my head around skinning things in Babylon. I guess I’m missing something obvious.

Can you see why the cube in this simple example is not moving?
https://playground.babylonjs.com/#76444U#29

Let me add @Drigax to the thread as he is awesome with skinning. He ll be back tomorrow due to labor day.

But as a first hint you should not see Bad Bone Indices = 96 in the report I guess it is because during the construction, you are passing 3 as an index but you only have 3 bones.

Thanks @sebavan.

Yeah, I’m aware of that. I think there is an error in validateSkinning.
The thing is, if I change the last index to one that exists, the mesh disappears, so I left it at 3.

I was planning to make a pull request on validateSkinning but I would like to be sure I’m doing things correctly first.

I am pretty sure the index should exist with an influence of 0 to not break at runtime. Let see what @Drigax can find.

Sure, that makes sense. Here’s an updated Playground with an existing index and zero weight.
https://playground.babylonjs.com/#76444U#30

Unfortunately the mesh disappears but perhaps it’s just offset somewhere due to something I’m not aware of?

One matrix (namely the inverted absolute transform) has to be set for each bone.

The easiest way to do that is to call skeleton.returnToRest():

https://playground.babylonjs.com/#76444U#31

O.M.G. That is truly amazing. Thank you!

If only that was in the docs.

I guess no one minds if I make a PR that adds a note about it on this page:
https://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons

2 Likes

would actually be great !!!