8.8.2 ODEBodyManipulator -- Apply external forces/torques to bodies

The ODEBodyManipulator class can be used to apply external forces and torques to a rigid body.

class ODEBodyManipulator
You get an instance of this class by calling the createBodyManipulator() method of the ODEDynamics component. One particular body manipulator instance is always associated with one particular rigid body. A manipulator object has the following attributes and methods:

body
This attribute contains the rigid body (WorldObject) this manipulator is associated with. You can only read this attribute. If you want to control another body, use the createBodyManipulator() method of the dynamics component.

odebody
This is the Body instance of the PyODE module. You can use this object if you want to access special features of ODE that are not exposed otherwise. But note that you won't get the expected results if you call methods like addForce() directly on the ODE body and you're using more than one sub step in your simulation. The force would only be applied during the first sub step because it is reset after each step. Use this manipulator class instead, that's what it's for.

addForce( force, relforce=False, pos=None, relpos=False)
Add an external force to the current force vector. force is a vector containing the force to apply. If relforce is True the force is interpreted in local object space, otherwise it is assumed to be given in global world space. By default, the force is applied at the center of gravity. You can also pass a different position in the pos argument which must describe a point in space. relpos determines if the point is given in object space or world space (default).

addTorque( torque, reltorque=False)
Add an external torque to the current torque vector. torque is a vector containing the torque to apply. reltorque determines if the torque vector is given in object space or world space (default).

setInitialPos( pos)
Set the initial position of the body. pos must be a 3-sequence of floats containing the new position.

setInitialRot( rot)
Set the initial orientation of the body. rot must be a mat3 containing a rotation matrix.

setLinearVel( vel)
Set the initial linear velocity of the body. vel must be a 3-sequence of floats containing the new velocity.

setAngularVel( vel)
Set the initial angular velocity of the body. vel must be a 3-sequence of floats containing the new velocity.

setPos( pos)
Set the position of the body. pos must be a 3-sequence of floats containing the new position.

setRot( rot)
Set the orientation of the body. rot must be a mat3 containing a rotation matrix.

setLinearVel( vel)
Set the linear velocity of the body. vel must be a 3-sequence of floats containing the new velocity.

setAngularVel( vel)
Set the angular velocity of the body. vel must be a 3-sequence of floats containing the new velocity.