Moving bones to different position

I’m trying to consolidate meshes from one skeleton into a single “base” skeleton.

I have connection points like the spine, left arm, right arm. What I’m doing is moving a mesh into a different skeleton then I need to move it so it connects to the bone but I’m not sure how to get the position of the target bone.

I have a playground here https://playground.babylonjs.com/#AI95IU#3
The function that moves the bone into place is in the Bodypart.move() function

I have these pieces:

  • base (this has the “root” bone)
  • upper body
  • left arm
  • right arm

These are the steps I need to do:

  1. move upper body so its spine is in the same position as the spine of the base
  2. move right arm so its arm bone is in the same position as the right arm bone of the base
  3. move left arm so its arm bone is in the same position as the left arm bone of the base
  4. export GLB and check to see that the bones have moved into place, not just the meshes

It looks like the only way to really move the bone is by updating its base matrix. I’m just not sure on what offset to apply to the bones position to get it into the correct position. Does anyone know the best way to go about this?

1 Like

@Pryme8 @MackeyK24 there’s some cash-money in this one fellas. I know you both are super-smart dudes that could easily figure this one out!

When I read the subject line I first thought you were seeking help to move a body :skull_and_crossbones::innocent:

5 Likes

Ayyyy what us up brother!

If I get some time here ill try to take a look, been super duper overloaded with things.

I’m glad to see you still at it and @mrlooi is really good with bone stuff and retargeting too, he might be a contender for an answer.

Adding @PatrickRyan and @Evgeni_Popov

Hey there!

I remember trying to figure out something similar

Perhaps this thread would help. The solution I posted shows the relationship between the bone parents and the matrices

1 Like

Thanks for the suggestion. I’ve checked out that thread. Its doesn’t apply here 'cos the local matrix and base matrix is always the same, but its giving me some ideas.

Hey @sebavan tagging you bc i know we chatted on twitter a couple months ago. First off, we really appreciate everyones suggestions on this post. Unfortunately, our entire product launch revolves around snapping and we still have not found a solution.

I am willing to up the bounty or contract hire anyone you may recommend that can fix this with us. We have delayed our launch to try to sort this but every direction seems to be a dead end. This is the last missing piece and we are really hoping to get some help on this as soon as possible. Please let me know if there is a bounty price that may make someone interested in helping solve the issue at hand.

Thank you for your help.

local and base matrix are always the same…

Wait a tic… why should that always be the case if the local matrix is supposed to position the bone in local space relative to its parent?

@josie, we have answered this week a couple questions regarting bone rotations using the same model so I supposed they were related.

The current playground here is a bit big to troubleshoot.

Could you provide a smaller one focused only on this issue ?

cc @PatrickRyan and @Evgeni_Popov

Hi @josie
This is Json from US
I’m a webgl developer
Do you need any help, if so please contact me
I’m always open for you
Thanks

@ozRocker if you like different wired way to fix that i can help

I just want to know which one of you ‘big brains’ :brain: :grin: gets the cherry :cherries: :thinking:?
Because, let’s face it, I have no faen clue :face_with_monocle:
Now I just can’t believe Yours are all so wealthy that you do not care about getting a grant for such a little effort :rofl: …May be there’s a zero missing in this reward :money_mouth_face:, is it? :laughing:

@ozRocker make animation full in GPU without skelton and bone
(support all readyplayer me players )

live test simple bone

part 1

part 2

part 3 make full smooth animation

1 Like

OMG It was so cool to hear you talk <3 @nasimiasl , always love looking at the stuff you have done.

1 Like

Thanks for the help everyone. Unfortunately we have no control over the avatars provided so we aren’t able to change the skeletons. Still not sure if BabylonJS can even solve this problem but we’ve decided to offload the work to a Blender server since Blender can do this via scripting without any complications.

I think being able to reference the python/blender scripts, it’d be way easier to implement.