Jump to content

Using IK Bone Controller


JCPalmer
 Share

Recommended Posts

I have been experimenting using the IK bone controller for moving legs.  The best I have been able to achieve is the knee going correctly with the foot facing backward.  I went back to the doc scene, and wanted to replicate the problem, but there are too many bones for Dude, & they are all named 'bonexx', where xx is the index.  First question, what are the indexes of a calf & thigh bones?

Next thing I did was turn off the animation, leaving only the ik controller update in the before render.  Without the animation it is completely wrong, https://www.babylonjs-playground.com/#1EVNNB#103.  I know having a nice demo can be nice, but more difficult if building up your own stuff where you are adding things as you get them worked out.

Also, I am using 3.0.  Were there any changes for this area for 3.1, I need to be aware of?

Thanks.

Link to comment
Share on other sites

3 hours ago, JCPalmer said:

Also, I am using 3.0.  Were there any changes for this area for 3.1, I need to be aware of?

No

3 hours ago, JCPalmer said:

what are the indexes of a calf & thigh bones?

I don't know.  What I did to find the arms was trial and error.

Link to comment
Share on other sites

Well, after a few attempts of checking each bone in Dude in ascending order, I guessed legs were last.  left calf is 55, and left thigh is 54.  Turns out I can get it to work here, so now I have something to go back and check against.

IMO, I think this pg is much better than the one in the docs.  Especially since there is no animation which also turns the character 180 degrees.  https://www.babylonjs-playground.com/#1EVNNB#104

Link to comment
Share on other sites

Sorry, @adam, but had to un-solve.  I have problems getting this to work with my skeleton, which comes from MakeHuman.  I constructed a very similar playgound, https://www.babylonjs-playground.com/#UVQWEI#1.  Results are not as good.

The only thing I see different, other than the mesh scaling, is the differences in orientation. I thought x was red, y was green, & z was blue.  Not sure what might need to be done.

nate.jpg.5515091a124c2e0736a195a9f256f4e6.jpgdude.jpg.881434a65ddb3cd6790f9e0725e5252e.jpg

Link to comment
Share on other sites

That did it.  After putting bendAxis in the GUI, and trying  a few combinations, I found setting x to -1 did it.  https://www.babylonjs-playground.com/#UVQWEI#2

There are many different ways to come up with a good location for pole target.  Found could get one by only changing the Z axis to -1.  Actually the sliders really only did whole numbers.  Going to switch to fractions next to refine.

Also, I am going to need to do the same with the right leg, so I thought I could use the same pole target for both, saving a mesh.  There is still the poleTargetLocalOffset in case I wished different between the controllers.  When I went to check the source code for that, I saw that you could also use a bone for pole target.  I have a root bone at 0, 0, -0.226.  Using 0 meshes sounds even better, as long as getAbsolutePositionFromLocalToRef() is not vastly more expensive than TransformCoordinatesToRef().

bendAxis.thumb.jpg.a762eda4f1c92a322a08632173db2e5d.jpgroot_bone.jpg.d4d173a75a061f9f7e084deafd416b04.jpg

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