Regular API function

simAddForceAndTorque / sim.addForceAndTorque

Description Adds a force and/or torque to a shape object that is dynamically enabled. Forces are applied at the center of mass. Added forces and torques are cumulative, and are reset to zero after sim.handleDynamics was called (or by using the following flags: sim.handleflag_resetforce and/or sim.handleflag_resettorque). See also sim.addForce.
C synopsis simInt simAddForceAndTorque(simInt shapeHandle,const simFloat* force,const simFloat* torque)
C parameters
shapeHandle: handle of a dynamically enabled shape. Can be combined with sim.handleflag_resetforce and/or sim.handleflag_resettorque in order to clear the accumulated force or torque.
force: pointer to 3 values that represent the force (in absolute coordinates) to add. Can be NULL.
torque: pointer to 3 values that represent the torque (in absolute coordinates) to add. Can be NULL
C return value
-1 if operation was not successful. In a future release, a more differentiated return value might be available
Lua synopsis number result=sim.addForceAndTorque(number shapeHandle,table_3 force,table_3 torque)
Lua parameters
Same as C-function
Lua return values
Same as C-function

All regular API functions on one page