I am exploring Bullet Solver for the first time in more depth since it’s release and having a fun time of it, but quite stuck on the problem of applying torque in a specific local space direction to an actor using a hinge constraint.
My bigger goal here is potentially building autonomous “creatures” that can eventually learn to walk through random “genetic” iteration of creation parameters etc.
However right now I’m just trying to make a leg work right.
Here’s what I do have working so far. The red block is the “body”, right now I just have it suspended in the air with infinite mass turned on.
The light grey block is a “leg” I guess, and it’s connected via a hinge constraint with limits in either direction.
While this works more or less, there is a big problem that breaks the system when the parent (red) is rotated manually via Ry parameter.
When the red block rotates past 90 degrees, you can see how the grey block droops, then when it’s rotated closer to 180, it flips in the other direction.
While I’ve re-simplified my attached TOE file to the problem shown above, I’ve tried a mess of things with matrix calcs, quaternions, and vectors. Maybe I’m overcomplicating it though.
The closest I got was with matrices was putting the leg in it’s parent space, and calculating it’s 2d rotation and comparing it to the “target” 2d rotation giving me an angle. Still broke down once the parent rotated past 180 degrees and the rotation flipped back around.
Is what I’m trying to do possible? Is there an easier way?
bullet solver torque challenge.4.toe (10.2 KB)