simGetContactInfo

Retrieves contact point information of a dynamic simulation pass.

C++ synopsis

int simGetContactInfo(int dynamicPass, int objectHandle, int index, int* objectHandles, double* contactInfo)

Arguments

  • dynamicPass: specific dynamic sub-step index or sim.handle_all. By default a call to simHandleDynamics executes the dynamics engine x times, with x times smaller time steps (where x is a parameter that can be adjusted). At each of those sub-steps, contacts are created and destroyed. With the dynamicPass argument you can select which sub-step you wish to retrieve contacts from (zero-based index), or sim.handle_all to retrieve the contacts of all sub-steps. See also simGetInt32Param(sim.intparam_dynamic_step_divider).
  • objectHandle: handle of a specific object you wish to retrieve contacts from, or sim.handle_all to retrieve all contacts in the scene.
  • index: zero-based index of the contact to retrieve. Optionally, you may add sim.handleflag_extended to the index, if you also wish to retrieve the normal vector (see further down)
  • objectHandles: handles of the two objects contacting. The handles might also refer to particle objects that are not treated as regular scene objects.
  • contactInfo: pointer to 6 values (or 9 values if sim.handleflag_extended was added to index), where the 3 first values represent the contact position, the 3 next values represent the force generated by the contact, and the (optional) 3 last values represent the normal vector at the contact. The force vector returned by the Bullet engine will omit the component that results from fricition.

Return

  • -1 in case of an error, 0 if no contact was found at the given index or 1 if a contact was returned.