JCPalmer Posted November 20, 2017 Share Posted November 20, 2017 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. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted November 20, 2017 Author Share Posted November 20, 2017 Ah, Looking closer, I am pretty sure why the pg is wrong when animation is turned off. The animation turned the body, so the target mesh is now in the wrong place. Still leaves the othe 2 questions though. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 20, 2017 Share Posted November 20, 2017 Pinging @adam who designed the IK Bone controller for us (regarding 3.0 to 3.1 I see no change that should be a problem here) Quote Link to comment Share on other sites More sharing options...
adam Posted November 21, 2017 Share Posted November 21, 2017 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. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted November 21, 2017 Author Share Posted November 21, 2017 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 Quote Link to comment Share on other sites More sharing options...
adam Posted November 21, 2017 Share Posted November 21, 2017 IMO, it is important to show a demo where the animation is playing. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted November 21, 2017 Author Share Posted November 21, 2017 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. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted November 21, 2017 Share Posted November 21, 2017 set up a function to swizzle the axes? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted November 21, 2017 Author Share Posted November 21, 2017 Also went back to Blender. I was expecting the Y & Z axis to be swapped from the export, but not the case. Quote Link to comment Share on other sites More sharing options...
adam Posted November 22, 2017 Share Posted November 22, 2017 I’m on my phone right now so I wasn’t able to view the PG, but it sounds like you may need to use the bendAxis feature. That allows you to define the local axis the joint will bend on. JCPalmer 1 Quote Link to comment Share on other sites More sharing options...
adam Posted November 22, 2017 Share Posted November 22, 2017 This looks better: https://www.babylonjs-playground.com/#UVQWEI#3 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted November 22, 2017 Author Share Posted November 22, 2017 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(). Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted November 22, 2017 Author Share Posted November 22, 2017 Epilogue: Using the root bone was perfect. It worked for both feet. The only thing I had to change for the right leg is pole angle from PI to 0. I like when magic numbers work. See (probably me 3 mos from now) https://www.babylonjs-playground.com/#UVQWEI#5 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.