Havok physics on walk

I would like to use Havok physics to walk on the simulation space.

If I enable physics, I cannot move or slide the object to any angle or to any position to bend the joint.

What implementation is needed to achieve this behavior?

I want it to walk like in the following video.

Please let me know if you need additional information so I can prepare it.

1 Like

cc @carolhmj and @Cedric

did you try this ? PhysicsBody | Babylon.js Documentation

Thanks I’ll give it a try.


Thank you.

I can now do the physics calculations and move the parts around.
I can also see it in the playground.

I have a constraint between two objects, but it slips.
Do I need to use other restraints?

Or do I need a completely different approach?

BTW, It appears that the specification for the Physics extension of glTF is currently under development.
Perhaps in the near future, once this is completed, it will be possible to make a robot walk with a single glTF file.

1 Like

@eoin Can I try the robot in the glTF physics extension sample above?

Hi @cx20,

Surprised that video is going around so quickly - it was only recorded on Tuesday :slight_smile:.

You sure can see the robot, but I’m not sure how helpful it will be - it’s very much a work-in-progress and the asset isn’t done yet. In particular, I’m looking at adding a new motor type to Babylon physics (though shouldn’t be necessary for OP’s use-case) and we’ve renamed some of the glTF physics fields, so some of the existing sample assets need to be re-exported to work.

Couple of options for you; check out the “constraintMotors” branch of the plugin (GitHub - eoineoineoin/glTF_Physics_Babylon at constraintMotors) then drag-and-drop the robot (hosted on my personal site while it’s WIP) onto the demo. I also have this branch running on my personal site here if you just want to check it out.

It’s setup a little unusually, as I want it to run purely with physics (i.e. without any animation or code) but for OP’s use-case, there’s definitely a simpler way. What I’d recommend OP do is to setup a constraint which permits the “leg” to move in the allowed range. You can’t describe the red area exactly, but the idea would be to set the limits so that they cover at least that area.


Then, add a PhysicsConstraintMotorType.POSITION motor to the two axes; set a high max force and stiffness. In code, calculate where you want the leg to be on each axis and set the motor’s target to that position.

As for how the robot works without any code/animation, the setup looks like this:

There’s a bunch of constraints which work together to get the effect.

The grey cylinder in that image represents a body which has no shape. That cylinder is constrained to the robot body and can only rotate around the cylinder axis. It has a PhysicsConstraintMotorType.VELOCITY motor causing it to rotate around the cylinder axis.

Then, each of the legs has a BallAndSocketConstraint attaching it to the cylinder, so the legs will move in a circle as the cylinder rotates.

Finally, to keep the legs at the right orientation, there’s a constraint between each leg and the body of the robot, locking all three angular axes to make sure the legs have the same orientation as the robot body.