Physics API - can force(s) quantity(s) be accessed?

I haven’t used the physics API at all, and a scan through the docs, doesn’t help too much with this question.

I want to setup a simple model of a lever, just a cube (rectangle), then be able to apply a force to it to make it rotate.

I’d then like to display the resulting speed of rotation of the lever, as well as the location and magnitude of the applied force.

  1. Is it possible to specify the location of where the force will be applied to the “lever” ?

  2. Does the API have access to the resulting motion data, in either angular units travelled (degrees, radians) or any other units ?

Mike

Check out the KX_GameObject class methods and properties. There’s some stuff in there that might be of use to you such as applyForce(), applyTorque(), localAngularVelocity, worldAngularVelocity, etc.

Thanks !

Looks like it does everything I asked for ! :slight_smile:

Ok, how do I “pin” the top of my lever so that it “hangs” from something.

I made it a dynamic object but it just falls to the floor (not surprisingly)

Rigid body constraints is what You want to look after. Available both from the gui and python (more features through python).