Jump to content

BoneIKController and bone orientation


shen
 Share

Recommended Posts

In Babylonejs, BoneIKController assumes that all bones are oriented along the x-axis, like the Dude example http://www.babylonjs-playground.com/#1EVNNB#15

I find that "The bones should be oriented along the y-axis". Here is the demo of using BoneIKController with y-axis http://www.babylonjs-playground.com/#1EVNNB#46. To make it work correctly, you need to change

BABYLON.Matrix.RotationYawPitchRollToRef(0, 0, Math.PI * .5, mat2);

to

BABYLON.Matrix.RotationYawPitchRollToRef(0, 0, 0, mat2);

in babylon.boneIKController.ts file. 

Of course, we can't expect that not all bones follow the same convention. So I wonder

  1. Will it be solved by adding {adjustYaw, adjustPitch, adjustRoll} option like BoneLookController?
  2. Is it possible to detect the bone orientation automatically?

Or we just add bone orientation parameter to BoneIKController. 

Link to comment
Share on other sites

On 2/12/2017 at 7:40 AM, shen said:

In Babylonejs, BoneIKController assumes that all bones are oriented along the x-axis, like the Dude example http://www.babylonjs-playground.com/#1EVNNB#15.

Here is a demo with a simple model that was created in Blender that has bones oriented along the y-axis:

http://www.babylonjs-playground.com/#PNJGW#7

Please post an example that demonstrates the issue you're having.  You might just need to change the bendAxis.

In this example, the second bone is bending on the z axis:

http://www.babylonjs-playground.com/#PNJGW#6

I might need to improve the way the default bend axis is set if it isn't set by the user.

https://github.com/BabylonJS/Babylon.js/blob/master/src/Bones/babylon.boneIKController.ts#L58

 

Link to comment
Share on other sites

I might not describe it clearly. I'm talking about how to make the bone point to the target (no the default bend axis). 

For your 2 examples, y-axis always point to the target mesh (with or without bendAxis option), seems because BoneIKController._rightHandedSystem is false. 

For my example http://www.babylonjs-playground.com/#1EVNNB%2346 and the dude demo http://www.babylonjs-playground.com/#1EVNNB%2315 (both _rightHandedSystem = true), x-axis always point to the target mesh. I can make them work with y-axis by setting BoneIKController._rightHandedSystem to false (It will cause another problem with bending). Is it Babylonjs' problem or the meshes' error?

Link to comment
Share on other sites

  • 2 years later...

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...