SkeletonViewer v4.2 - What changed?

@Deltakosh did you fix that already? Because I checked my branch I dont even see any declarations to skeletonViewer.material anywhere?
UPDATE yeah he did :slight_smile: I see the commit!

It would be skeletonViewer.debugMesh.material if you are trying to access that.

I can add a getter/setter for you if that makes things easier!

@Pryme8

Any idea what’s going on with the sphere and spurs in this Playground. They look pretty whacky.

I have no clue what is going on in this scene XD.

Ummmm, looks like you might have multiple skeletons and the green one has some incorrect values maybe?

That is rather odd, Id have to see your data, which one is the green skeleton coming from? It looks like the gray one is correct and Im assuming that is the imported one?

@Pryme8 I’ve described the purpose of the different skeletons here, hope it makes sense:

I’m trying to simplify the workflow so that I only need one source skeleton and one target skeleton but I’m a bit stuck at the moment.

@Pryme8 I managed to reproduce it in an isolated example, and I have a theory what’s going on.

https://www.babylonjs-playground.com/#7GM6J3#3

In this Playground, I set the rest pose to that of the hips and leftUpLeg bones in my other Playground. I then set the position and rotation to that of the animation data on frame 300.

Since there is a slight difference in the rig rest pose and the animation data rest pose, they don’t line up perfectly so I guess that’s why the parent bone doesn’t point on the child bone.

Would it make sense to update the spur of the parent bone to point at the bone which position was changed?

I still have no idea what I am looking at XD.

We have no control directly over the spurs and spheres they are not physically being positioned but rather just distorted by bone weights, there would be no real reason for what you to see to happen unless underlying data is wrong.

If you can help me figure out whats really going on I can help but Im rather clueless what we are looking at in your PG

It also seems like you have multiple congruent posts about this so at this point Im not sure which to address and which overlap.

Haaaaalp… lol well figure this out.

@Pryme8

If you comment out line 23:

b2.position = ...

You will see that it looks alright before updating the child bone’s position.

Here’s another example

In line mode the parent bone points to the child bone as I would expect.

UPDATE

…you have multiple congruent posts about this so at this point Im not sure which to address and which overlap.

Well, this thread is about the SkeletonViewer.

The other is about how to freeze transformations of a bone / rest pose problems.

There is a third thread about not being able to transfer animations to an imported skeleton (which I gave up on).

https://www.babylonjs-playground.com/#7GM6J3#6

Your matrices are not being updated correctly after the position change. Not sure why. This would not be on the SkeletonViewer

And you should be able to copy animations over of the bones are the same. Um hm does this happen on imported bones too?

https://www.babylonjs-playground.com/#7GM6J3#7

Had to reset your restpose

@Pryme8

So the only why to get it looking OK is to change the rest pose. But that I cannot do since I need it for animations. So I guess I need to start digging in bone.ts. :expressionless:

No just when you make the skeleton viewers, after that play all the animations you want. They require the restposes to be weighted correctly. It’s that your manually created bones don’t have the same matrices prepared as if it was imported because you are managing them it will be on you to make sure the data is correct when you make the viewer after that anything you do to the bone will move the visual. Otherwise if you are not able to setup your data correct your fallback is the lines mode which samples positions every frame as opposed to the second two modes which are a skinned unified mesh.

That seem to be true for rotation and scale, but everytime you change the position of a child node you get disconnected spurs.

I did some digging in Maya and it looks like whenever you change the position of a child joint the parent local rotation axis is not affected, but the visual representation of the skeleton is updated so that all joints are connected at all times.

Translating joints in Maya:
maya-joints

Translating bones with Babylon:
babylon-bones

You technically are changing the length of the bone in Maya and its automatically assuming you want that functionality. BJS is not Maya or an editor and when you move a child bone its more or less an offset from the parents end. If you want functionality like that you have to script it because we do not assume to modify the parents data when changing a child. Babylon is just a rendering engine you create things like that for it as extensions, but as a word of faith it is all possible!

My current full time job is working with a team who is making an animation editor so we have had to deal with a lot of the things you are concerned about as well. So take it from me with a little bit of ingenuity you can make it happen to.

Why not create a class that you can pass bones you want connected like that and you will have to update function after some sort of translation action like you are doing.

1 Like

There is now a new option that solves the issue of changing bone positions.

2 Likes