Jump to content

How to control multiple bones simultaneously?


Recommended Posts

sm10.glbThis is the GLB file,You can get bones in the following way:)

scene.getBoneByName("Kości medyk_Head").rotate(BABYLON.Axis.Y, Math.sin(t) * Math.PI);
scene.getBoneByName("Kości medyk_L Arm").setAxisAngle(BABYLON.Axis.Y, Math.sin(t) * Math.PI);
scene.getBoneByName("Kości medyk_R Arm").setAxisAngle(BABYLON.Axis.Y, Math.sin(t) * Math.PI);
scene.getBoneByName("Kości medyk_Bone").setAxisAngle(BABYLON.Axis.Y, Math.sin(t) * Math.PI);

 

Link to comment
Share on other sites

Why not do it in blender, since you already have the file on hand?

All you have to do is create a new bone without any vertices/weights assigned to it and place it right where your pivot should be(right above your Body bone). You link the head, arms and gun bones to this bone, and then link this bone to the Body bone. Then the skeleton will behave as before, while giving you the opportunity to transform the upper body using one control point.

If it Has to be done in BabylonJs, then that is possible as well by creating a new bone, and doing the same thing as discussed above:

https://doc.babylonjs.com/api/classes/babylon.bone#constructor

Link to comment
Share on other sites

I agree with @Raggar that the easiest way to create your skeleton hierarchy is in a DCC application. If you are thinking of doing something like swapping meshes like changing the gun on your character, the easiest way would be to instantiate the mesh in the correction position and then parent it to the bone that should control it like the hand. That way your mesh will animate with the hand of the character and can be changed at runtime. For any skeleton hierarchy created in Babylon.js or in a DCC app, rotating a joint will affect all children of that joint. You could assign quaternion animation to the bone you want to animate ( https://doc.babylonjs.com/features/animations ), but it is much easier and faster to animate in your DCC package and call the animation you need. ( http://doc.babylonjs.com/how_to/group )

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...