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 nullptr.
torque: pointer to 3 values that represent the torque (in absolute coordinates) to add. Can be nullptr
C return value
-1 if operation was not successful
Lua synopsis sim.addForceAndTorque(int shapeHandle,table[3] force,table[3] torque)
Lua parameters
Similar to the C-function counterpart
Lua return values