• 3D
  • 3D Legged Robot -- How to rotate a node with a HingeJoint and keep the other node in place?

I am experimenting with 3D joints and physically-based animation in Godot. My current setup is a quadruped robot with 3 joints in the legs:

(1) thigh: connects 'body' to leg 'upper'. (2) knee: connects 'upper' to 'lower'. (3) ankle: connects 'lower' to 'foot' (for now this one is unactuated).

All joints are HingeJoint. Right now I am just trying to get the 'Thigh' joint to correctly rotate the leg. The hierarchy of the robot is depicted below (the robot is currently turned upside-down for testing).

All joint connections are rigid bodies. The issue I am having is that when the 'body' RigidBody is made static, the leg correctly rotates, like so:

But when the 'body' RigidBody is made rigid (the behaviour I hope to have eventually), the leg and body seem to try to rotate one-another and the robot leg does not move, like so:

I am thinking perhaps it has to do with how my RigidBody tree is set-up. Is there a setting where I can lock one of the nodes attached to a HingeJoint? Any help/discussion much appreciated.

EDIT: Interestingly, if I set the default physics engine to be not Bullet (Godot's custom one), then I get the intended dynamics. Perhaps this might give someone a clue as to what is going on here...

EDIT2: So I've simplified the problem down further and found that there is indeed a difference between Godot-engine and Bullet-engine for getting the result I want. With this joint tree (the knee joint is motor-enabled and the thigh joint is motor-disabled):

... run with Bullet physics, the second knee joint causes the upper joint to move like so:

... but, run with Godot physics, the correct behaviour happens with the knee joint bending independently:

Have I now missed something implementation-wise that is unique to getting Bullet physics working for a hierarchy of joints? Or is this a bug?

I have found a solution to my own problem. I'll leave it here should anyone else have the confusion I did.

The issue seems to be in having a hierarchy of the RigidBody's you want to make joints. If two RigidBody's are parent and child, then the joint will not actuate between them (for the Bullet physics). Instead, the RigidBoy's must be put at the same level in the tree, like so:

It doesn't matter where you place the joints (from what I've found experimenting), but just that the RigidBody's have to all be at the same level in the tree.

Thanks for posting the solution, and welcome to the forums!