Collision detection

CoppeliaSim can detect collisions between two collidable entities in a very flexible way. The calculation is an exact interference calculation. The collision detection module will only detect collisions; it does however not directly react to them (for collision response, refer to the dynamics module). Following figure illustrates the collision detection functionality:

[(1) Simple collision detection between two manipulators, (2) Exhaustive collision detection between two shapes]

The collision detection module allows registering collision objects which are collidable entity-pairs (collider entity and collidee entity). During simulation, the collision state of each registered collision object can then be visualized with a different coloring, or recorded in a graph object. Refer to graphs and graph data stream types for more information about how to record collision states. Registered collision objects are automatically duplicated (copied) if their two composing entities are duplicated simultaneously in a copy-paste operation.

The collision detection routines used in the collision detection module are also available as stand-alone routines via the Coppelia geometric routines.

The collision detection dialog is part of the calculation module properties dialog, which is located at [Menu bar --> Tools --> Calculation module properties]. You can also open the dialog with a click on its toolbar button:

[Calculation module properties toolbar button]

In the calculation module properties dialog, click the Collision detection button to display the collision detection dialog:

[Collision detection dialog]

  • Enable all collision detections: allows enabling or disabling collision detection of all registered collision objects.
  • Add new collision object: allows specifying two entities for collision detection. The list below the button displays all registered collision objects that can be renamed with a double-click. Individual collision objects in the list can be selected, and related properties are then displayed below (see hereafter)..
  • Adjust collision color: allows adjusting the color that a colliding entity will be displayed in. See also the Collision changes collider color and Collision changes collidee color items further down.
  • Explicit handling: indicates whether the selected collision object should be explicitly handled. If checked, collision detection for this collision object will not be handled when sim.handleCollision(sim.handle_all_except_explicit) is called, but only if sim.handleCollision(sim.handle_all) or sim.handleCollision(collisionObjectHandle) is called. This is useful if the user wishes to handle collision detection for that collision object in a child script rather than in the main script (if not checked, collision detection for that collision object will be handled twice, once when sim.handleCollision(sim.handle_all_except_explicit) is called in the main script, and once when sim.handleCollision(collisionObjectHandle) is called in the child script). Refer also to the section on explicit and non-explicit calls.
  • Collision changes collider / collidee color: enables or disables a color change during collision for the collider / collidee entity.
  • Comp. coll. contour (shapes only): if enabled, then an exhaustive collision detection will be performed for shape-shape collisions: all intersections (i.e. the collision contour) are calculated and visualized. This however requires much more computation time than simple collision detection.
  • Adjust contour color: allows adjusting the color of the collision contour line (see the Compute collision contour item above).
  • Contour width: width of the collision contour line (see the Compute collision contour item above).

  • Recommended topics

  • Coppelia geometric routines
  • Related API functions
  • Collidable objects
  • Scene objects
  • Collections