Is there some official way or unofficial or 3rd party library that will allow to move character joints procedurally both in IK as well as FK in Panda3d?
This is something I need for a new project and can’t aford to write from scratch so I have to choose between Unity and Panda3D here based on this.
For procedural control of joints, there are control joints. However, Panda3D has no builtin IK support, and I am unaware of any third-party module that provides it.
IK Is essential for things like procedural foot placement in 3d games, it’s been around as a feature for a very long time. Shame that Panda still doesn’t have it.
Still, there seem to be some 3rd party Python libraries that claim to do that, so dummy nodes may be made to be influenced by them. I haven’t gotten much into each of these libraries so they may not work for realtime 3d, but maybe they do.
I’m not a trained programmer, but I did once write a simple (read, RP only, two joints only) IK script a loooooooooooooooong time ago for Alice.
I was stumped until a real programmer pointed out that I needed the quadratic equation to solve, and once that was put it the code was pretty minimal.
I have no idea if submitting some pseudocode of this would help, but I think I can dig it up.
Might help, depending on what you mean by two joints. To do the most simple walking/standing IK, you want the foot bone to be placed on and be angled according to the normal of the floor collision geometry polygon, while thigh and leg bones to rotate to follow the new position of the foot bone. So one joint is moved manually while two parent ones are rotated and moved (only leg for the latter) procedurally by IK. So if you have code to do that and the leg and thigh bones would be the two joints, then yes, that would work. But if only the leg bone was IK’d to the manually moved and rotated leg bone that wouldn’t be enough.
What I made for Alice was specifically for making walking animations. By two joints I mean the hip and ankle. Animating the feet were part of this code, but the are not influenced by the IK Handle.
I teach a Maya intro course and we cover basic IK so that’s how I conceptualize it. The IK handle starts at the hip, skips over the knee joint, and ends at the ankle joint, where Maya places (in the object hierarchy) what it calls the End Effector.
The End Effector reports its position to the IK Solver, which in turn decides what angle to rotate the hip joint and the knee joint, in order for the limb to meet the end effector.
The are always two ways to solve, so the positive result of the quadratic equation is with the leg bending one way, and the negative result is with it bending the other (ouch). In Maya this can be controlled by positioning the Pole Vector, placing it out in front of your character, but the Pole Vector can also be keyed so you can have the knees wobble, etc.
I found the code. It’s been so long I was blending two projects together in my mind: my “Walk Module” for Alice (because, at the time, Alice could not import keyframe animation; all animation was done with code) and “Inverse Kindamatics”, my pun on the fact that is was just enough IK to do the job.
In the attached script, you can see the two joints (rarm and rarm.r4arm) are hard-coded, as well as the “end effector” (a telephone object, apparently).
Maybe this will help you; not sure.
This convo has gotten me interested in making something better for Panda3D, since (apparently) there is nothing standard.inverseKindamatics.py (1.6 KB)