Hi @cx20,
Surprised that video is going around so quickly - it was only recorded on Tuesday .
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.