Node-based actor system with IK

I made some physics related extensions for Panda3D.
There are spring bone constraints and node-based actor system with IK and glTF loader.

When actor is loaded it looks like this in a node graph:

ModelRoot Sketchfab_Scene
  PandaNode Sketchfab_model T:m(hpr 0 -90 0 scale 1.88067)
    PandaNode 3ac980a0f52b48518619823ac2728462.fbx T:m(hpr 0 90 0)
      PandaNode Object_2
        PandaNode RootNode
          ArmatureNode Object_4
            BoneNode _rootJoint
              BoneNode mixamorig:Hips_01 T:m(pos 0.00124024 -0.0292593 0.575207)
                BoneNode mixamorig:Spine_02 T:m(pos 0 0.00797655 0.0569352 hpr 0 -7.97515 0)
                  BoneNode mixamorig:Spine1_03 T:m(pos 0 0 0.0670731 hpr 0 -7.22858e-06 0)
                    BoneNode mixamorig:Spine2_04 T:m(pos 0 0 0.076655)
                      BoneNode mixamorig:Neck_05 T:m(pos 0 0 0.0862368 hpr 0 7.97516 0)
                        BoneNode mixamorig:Head_06 T:m(pos 0 -0.00738599 0.02873)
                          BoneNode mixamorig:HeadTop_End_07 T:m(pos 0 -0.0784149 0.305018)
                      BoneNode mixamorig:LeftShoulder_08 T:m(pos 0.0288528 0.000861318 0.0754145 hpr -88.2904 69.1622 -179.937)
                        BoneNode mixamorig:LeftArm_09 T:m(pos 0 0 0.0628109 hpr -1.91619 21.9891 5.10597)
                          BoneNode mixamorig:LeftForeArm_010 T:m(pos 0 0 0.159448 hpr -2.23059 -7.30539 -17.0308)
                            BoneNode mixamorig:LeftHand_011 T:m(pos 0 0 0.159221 hpr -48.5177 25.421 7.34389)
                              BoneNode mixamorig:LeftHandThumb1_012 T:m(pos -0.00261159 -0.0130775 0.0242946 hpr 1.21474 28.1863 -2.5704)
                                BoneNode mixamorig:LeftHandThumb2_00 T:m(pos -0.00131939 0 0.0221319 hpr 0 10.3744 0)
                                  BoneNode mixamorig:LeftHandThumb3_013 T:m(pos 0.000652101 0 0.0219103 hpr 0 -28.2831 0)
                                    BoneNode mixamorig:LeftHandThumb4_014 T:m(pos 0.000667286 0 0.0160295)
                              BoneNode mixamorig:LeftHandIndex1_015 T:m(pos -0.00426523 0 0.0854612 hpr -3.74183 11.1874 18.628)
                                BoneNode mixamorig:LeftHandIndex2_016 T:m(pos -0.000597448 0 0.0107844 hpr 0 3.75699 0)
                                  BoneNode mixamorig:LeftHandIndex3_017 T:m(pos -0.000142954 0 0.0101097 hpr 0 11.5789 0)
                                    BoneNode mixamorig:LeftHandIndex4_018 T:m(pos 0.000740402 0 0.00665406)
                              BoneNode mixamorig:LeftHandMiddle1_019 T:m(pos 0.00426523 0 0.0237813 hpr 4.16083 -17.2412 13.7902)
                                BoneNode mixamorig:LeftHandMiddle2_020 T:m(pos -0.00230626 0 0.0431487 hpr 0 8.28572 0)
                                  BoneNode mixamorig:LeftHandMiddle3_021 T:m(pos 0.00236973 0 0.0190953 hpr 0 -3.29699 0)
                                    BoneNode mixamorig:LeftHandMiddle4_022 T:m(pos -6.34762e-05 0 0.0174083)
                      BoneNode mixamorig:RightShoulder_023 T:m(pos -0.0288528 0.00214586 0.0755944 hpr 85.7471 69.5131 179.976)
                        BoneNode mixamorig:RightArm_024 T:m(pos 0 0 0.0628109 hpr 0.544202 22.5787 -1.41712)
                          BoneNode mixamorig:RightForeArm_025 T:m(pos 0 0 0.159478 hpr 2.02279 -7.63257 14.8913)
                            BoneNode mixamorig:RightHand_026 T:m(pos 0 0 0.1586 hpr -25.5519 8.45542 18.3317)
                              BoneNode mixamorig:RightHandThumb1_027 T:m(pos 0.0149913 -0.00408954 0.0232044 hpr -4.47546 7.14138 32.1945)
                                BoneNode mixamorig:RightHandThumb2_028 T:m(pos 0.000366298 0 0.0223384 hpr 0 5.71474 0)
                                  BoneNode mixamorig:RightHandThumb3_029 T:m(pos 0.00345123 0 0.0224884 hpr 0 5.25907 0)
                                    BoneNode mixamorig:RightHandThumb4_030 T:m(pos -0.00381753 0 0.0201626)
                              BoneNode mixamorig:RightHandIndex1_031 T:m(pos 0.00745391 0 0.0721439 hpr -1.49538 10.0951 8.47092)
                                BoneNode mixamorig:RightHandIndex2_032 T:m(pos -0.00129494 0 0.0143013 hpr 0 11.1793 0)
                                  BoneNode mixamorig:RightHandIndex3_033 T:m(pos 0.00116076 0 0.0161998 hpr 0 -4.21517 0)
                                    BoneNode mixamorig:RightHandIndex4_034 T:m(pos 0.000134173 0 0.0128296)
                              BoneNode mixamorig:RightHandMiddle1_035 T:m(pos -0.00745391 0 0.0654357 hpr 32.6337 39.5736 -45.1474)
                                BoneNode mixamorig:RightHandMiddle2_036 T:m(pos -0.000274286 0 0.0182357 hpr 0 -47.2971 0)
                                  BoneNode mixamorig:RightHandMiddle3_037 T:m(pos 0.00128132 0 0.0115202 hpr 0 -89.5174 0)
                                    BoneNode mixamorig:RightHandMiddle4_038 T:m(pos -0.00100703 0 0.0029563)
                BoneNode mixamorig:LeftUpLeg_039 T:m(pos 0.0579814 0.0022677 -0.0316919 hpr 0 1.17734 174.847)
                  BoneNode mixamorig:LeftLeg_040 T:m(pos 0 0 0.266765 hpr -0.0518949 -2.36842 -1.25558)
                    BoneNode mixamorig:LeftFoot_041 T:m(pos 0 0 0.23895 hpr 1.8298 47.5929 0)
                      BoneNode mixamorig:LeftToeBase_042 T:m(pos 0 0 0.0390745 hpr -4.49762 45.6511 0)
                        BoneNode mixamorig:LeftToe_End_043 T:m(pos 0 0 0.023473)
                BoneNode mixamorig:RightUpLeg_044 T:m(pos -0.0579814 0.00133961 -0.0316919 hpr 0 1.1796 -174.847)
                  BoneNode mixamorig:RightLeg_045 T:m(pos 0 0 0.266765 hpr 0.0652802 -2.98167 1.25479)
                    BoneNode mixamorig:RightFoot_046 T:m(pos 0 0 0.239122 hpr -1.65918 50.6956 0)
                      BoneNode mixamorig:RightToeBase_047 T:m(pos 0 0 0.0408295 hpr 4.52533 43.148 0)
                        BoneNode mixamorig:RightToe_End_048 T:m(pos 0 0 0.0225807)
            PandaNode Object_6
              GeomNode YUKI__0 (1 geoms: S:(MaterialAttrib TextureAttrib))
            PandaNode YUKI

Each bone is wrapped in a NodePath and can be directly moved and rotated. All bone transforms then pushed into the shader through the texture.
I have also included an example of IK usage.
Animations are not supported yet.

Example video:

5 Likes

I have rewrited CCD IK library by Germanunkol in C and integrated it into my library.

Comparison of an old implementation and Germanunkol’s CCD:

3 Likes

VERY UPLIFTING!!!
Please keep your good work. :laughing: