- Main Page
- Modules
- Data Structures
- Files

# Collision Detection

## Data Structures
struct | dContactGeom
| Describe the contact point between two geoms. More...
## Functions
ODE_API void | dGeomDestroy (dGeomID geom)
| Destroy a geom, removing it from any space.
ODE_API void | dGeomSetData (dGeomID geom, void *data)
| Set the user-defined data pointer stored in the geom.
ODE_API void * | dGeomGetData (dGeomID geom)
| Get the user-defined data pointer stored in the geom.
ODE_API void | dGeomSetBody (dGeomID geom, dBodyID body)
| Set the body associated with a placeable geom.
ODE_API dBodyID | dGeomGetBody (dGeomID geom)
| Get the body associated with a placeable geom.
ODE_API void | dGeomSetPosition (dGeomID geom, dReal x, dReal y, dReal z)
| Set the position vector of a placeable geom.
ODE_API void | dGeomSetRotation (dGeomID geom, const dMatrix3 R)
| Set the rotation matrix of a placeable geom.
ODE_API void | dGeomSetQuaternion (dGeomID geom, const dQuaternion Q)
| Set the rotation of a placeable geom.
ODE_API const dReal * | dGeomGetPosition (dGeomID geom)
| Get the position vector of a placeable geom.
ODE_API const dReal * | dGeomGetRotation (dGeomID geom)
| Get the rotation matrix of a placeable geom.
ODE_API void | dGeomGetQuaternion (dGeomID geom, dQuaternion result)
| Get the rotation quaternion of a placeable geom.
ODE_API void | dGeomGetAABB (dGeomID geom, dReal aabb[6])
| Return the axis-aligned bounding box.
ODE_API int | dGeomIsSpace (dGeomID geom)
| Determing if a geom is a space.
ODE_API dSpaceID | dGeomGetSpace (dGeomID)
| Query for the space containing a particular geom.
ODE_API int | dGeomGetClass (dGeomID geom)
| Given a geom, this returns its class.
ODE_API void | dGeomSetCategoryBits (dGeomID geom, unsigned long bits)
| Set the "category" bitfield for the given geom.
ODE_API void | dGeomSetCollideBits (dGeomID geom, unsigned long bits)
| Set the "collide" bitfield for the given geom.
ODE_API unsigned long | dGeomGetCategoryBits (dGeomID)
| Get the "category" bitfield for the given geom.
ODE_API unsigned long | dGeomGetCollideBits (dGeomID)
| Get the "collide" bitfield for the given geom.
ODE_API void | dGeomEnable (dGeomID geom)
| Enable a geom.
ODE_API void | dGeomDisable (dGeomID geom)
| Disable a geom.
ODE_API int | dGeomIsEnabled (dGeomID geom)
| Check to see if a geom is enabled.
ODE_API void | dGeomSetOffsetPosition (dGeomID geom, dReal x, dReal y, dReal z)
| Set the local offset position of a geom from its body.
ODE_API void | dGeomSetOffsetRotation (dGeomID geom, const dMatrix3 R)
| Set the local offset rotation matrix of a geom from its body.
ODE_API void | dGeomSetOffsetQuaternion (dGeomID geom, const dQuaternion Q)
| Set the local offset rotation of a geom from its body.
ODE_API void | dGeomSetOffsetWorldPosition (dGeomID geom, dReal x, dReal y, dReal z)
| Set the offset position of a geom from its body.
ODE_API void | dGeomSetOffsetWorldRotation (dGeomID geom, const dMatrix3 R)
| Set the offset rotation of a geom from its body.
ODE_API void | dGeomSetOffsetWorldQuaternion (dGeomID geom, const dQuaternion)
| Set the offset rotation of a geom from its body.
ODE_API void | dGeomClearOffset (dGeomID geom)
| Clear any offset from the geom.
ODE_API int | dGeomIsOffset (dGeomID geom)
| Check to see whether the geom has an offset.
ODE_API const dReal * | dGeomGetOffsetPosition (dGeomID geom)
| Get the offset position vector of a geom.
ODE_API const dReal * | dGeomGetOffsetRotation (dGeomID geom)
| Get the offset position vector of a geom.
ODE_API void | dGeomGetOffsetQuaternion (dGeomID geom, dQuaternion result)
| Get the offset rotation quaternion of a geom.

## Detailed Description

ODE has two main components: a dynamics simulation engine and a collision detection engine. The collision engine is given information about the shape of each body. At each time step it figures out which bodies touch each other and passes the resulting contact point information to the user. The user in turn creates contact joints between bodies.

Using ODE's collision detection is optional - an alternative collision detection system can be used as long as it can supply the right kinds of contact information.

## Function Documentation

ODE_API void dGeomClearOffset | ( | dGeomID | geom | ) |

  | Clear any offset from the geom. If the geom has an offset, it is eliminated and the geom is repositioned at the body's position. If the geom has no offset, this function does nothing. This is more efficient than calling dGeomSetOffsetPosition(zero) and dGeomSetOffsetRotation(identiy), because this function actually eliminates the offset, rather than leaving it as the identity transform. Parameters:
  | geom | the geom to have its offset destroyed.

ODE_API void dGeomDestroy | ( | dGeomID | geom | ) |

  | Destroy a geom, removing it from any space. Destroy a geom, removing it from any space it is in first. This one function destroys a geom of any type, but to create a geom you must call a creation function for that type. When a space is destroyed, if its cleanup mode is 1 (the default) then all the geoms in that space are automatically destroyed as well. Parameters:
  | geom | the geom to be destroyed.

ODE_API void dGeomDisable | ( | dGeomID | geom | ) |

  | Disable a geom. Disabled geoms are completely ignored by dSpaceCollide and dSpaceCollide2, although they can still be members of a space. New geoms are created in the enabled state. Parameters:
  | geom | the geom to disable
See also: dGeomDisable dGeomIsEnabled

ODE_API void dGeomEnable | ( | dGeomID | geom | ) |

  | Enable a geom. Disabled geoms are completely ignored by dSpaceCollide and dSpaceCollide2, although they can still be members of a space. New geoms are created in the enabled state. Parameters:
  | geom | the geom to enable
See also: dGeomDisable dGeomIsEnabled

ODE_API void dGeomGetAABB | ( | dGeomID | geom,
|  | dReal | aabb[6]
| ) |

  | Return the axis-aligned bounding box. Return in aabb an axis aligned bounding box that surrounds the given geom. The aabb array has elements (minx, maxx, miny, maxy, minz, maxz). If the geom is a space, a bounding box that surrounds all contained geoms is returned. This function may return a pre-computed cached bounding box, if it can determine that the geom has not moved since the last time the bounding box was computed. Parameters:
  | geom | the geom to query
  | aabb | the returned bounding box

ODE_API dBodyID dGeomGetBody | ( | dGeomID | geom | ) |

  | Get the body associated with a placeable geom. Parameters:
  | geom | the geom to query.
See also: dGeomSetBody

ODE_API unsigned long dGeomGetCategoryBits | ( | dGeomID |  | ) |

  | Get the "category" bitfield for the given geom. Parameters:
  | geom | the geom to set
  | bits | the new bitfield value
See also: dGeomSetCategoryBits

ODE_API int dGeomGetClass | ( | dGeomID | geom | ) |

  | Given a geom, this returns its class. The ODE classes are: dSphereClass dBoxClass dCylinderClass dPlaneClass dRayClass dConvexClass dGeomTransformClass dTriMeshClass dSimpleSpaceClass dHashSpaceClass dQuadTreeSpaceClass dFirstUserClass dLastUserClass User-defined class will return their own number. Parameters:
  | geom | the geom to query
Returns: The geom class ID.

ODE_API unsigned long dGeomGetCollideBits | ( | dGeomID |  | ) |

  | Get the "collide" bitfield for the given geom. Parameters:
  | geom | the geom to set
  | bits | the new bitfield value
See also: dGeomSetCollideBits

ODE_API void* dGeomGetData | ( | dGeomID | geom | ) |

  | Get the user-defined data pointer stored in the geom. Parameters:
  | geom | the geom containing the data

ODE_API const dReal* dGeomGetOffsetPosition | ( | dGeomID | geom | ) |

  | Get the offset position vector of a geom. Returns the positional offset of the geom in local coordinates. If the geom has no offset, this function returns the zero vector. Parameters:
  | geom | the geom to query.
Returns: A pointer to the geom's offset vector. Remarks: The returned value is a pointer to the geom's internal data structure. It is valid until any changes are made to the geom.

ODE_API void dGeomGetOffsetQuaternion | ( | dGeomID | geom,
|  | dQuaternion | result
| ) |

  | Get the offset rotation quaternion of a geom. Returns the rotation offset of the geom as a quaternion. If the geom has no offset, the identity quaternion is returned. Parameters:
  | geom | the geom to query.
  | result | a copy of the rotation quaternion.

ODE_API const dReal* dGeomGetOffsetRotation | ( | dGeomID | geom | ) |

  | Get the offset position vector of a geom. Returns the positional offset of the geom in local coordinates. If the geom has no offset, this function returns the zero vector. Parameters:
  | geom | the geom to query.
Returns: A pointer to the geom's offset vector. Remarks: The returned value is a pointer to the geom's internal data structure. It is valid until any changes are made to the geom.

ODE_API const dReal* dGeomGetPosition | ( | dGeomID | geom | ) |

  | Get the position vector of a placeable geom. If the geom is attached to a body, the body's position will be returned. Calling this function on a non-placeable geom results in a runtime error in the debug build of ODE. Parameters:
  | geom | the geom to query.
Returns: A pointer to the geom's position vector. Remarks: The returned value is a pointer to the geom's internal data structure. It is valid until any changes are made to the geom. See also: dBodyGetPosition

ODE_API void dGeomGetQuaternion | ( | dGeomID | geom,
|  | dQuaternion | result
| ) |

  | Get the rotation quaternion of a placeable geom. If the geom is attached to a body, the body's quaternion will be returned. Calling this function on a non-placeable geom results in a runtime error in the debug build of ODE. Parameters:
  | geom | the geom to query.
  | result | a copy of the rotation quaternion.
See also: dBodyGetQuaternion

ODE_API const dReal* dGeomGetRotation | ( | dGeomID | geom | ) |

  | Get the rotation matrix of a placeable geom. If the geom is attached to a body, the body's rotation will be returned. Calling this function on a non-placeable geom results in a runtime error in the debug build of ODE. Parameters:
  | geom | the geom to query.
Returns: A pointer to the geom's rotation matrix. Remarks: The returned value is a pointer to the geom's internal data structure. It is valid until any changes are made to the geom. See also: dBodyGetRotation

ODE_API dSpaceID dGeomGetSpace | ( | dGeomID |  | ) |

  | Query for the space containing a particular geom. Parameters:
  | geom | the geom to query
Returns: The space that contains the geom, or NULL if the geom is not contained by a space.

ODE_API int dGeomIsEnabled | ( | dGeomID | geom | ) |

  | Check to see if a geom is enabled. Disabled geoms are completely ignored by dSpaceCollide and dSpaceCollide2, although they can still be members of a space. New geoms are created in the enabled state. Parameters:
  | geom | the geom to query
Returns: Non-zero if the geom is enabled, zero otherwise. See also: dGeomDisable dGeomIsEnabled

ODE_API int dGeomIsOffset | ( | dGeomID | geom | ) |

  | Check to see whether the geom has an offset. This function will return non-zero if the offset has been created. Note that there is a difference between a geom with no offset, and a geom with an offset that is the identity transform. In the latter case, although the observed behaviour is identical, there is a unnecessary computation involved because the geom will be applying the transform whenever it needs to recalculate its world position. Parameters:
  | geom | the geom to query.
Returns: Non-zero if the geom has an offset, zero otherwise.

ODE_API int dGeomIsSpace | ( | dGeomID | geom | ) |

  | Determing if a geom is a space. Parameters:
  | geom | the geom to query
Returns: Non-zero if the geom is a space, zero otherwise.

ODE_API void dGeomSetBody | ( | dGeomID | geom,
|  | dBodyID | body
| ) |

  | Set the body associated with a placeable geom. Setting a body on a geom automatically combines the position vector and rotation matrix of the body and geom, so that setting the position or orientation of one will set the value for both objects. Setting a body ID of zero gives the geom its own position and rotation, independent from any body. If the geom was previously connected to a body then its new independent position/rotation is set to the current position/rotation of the body. Calling these functions on a non-placeable geom results in a runtime error in the debug build of ODE. Parameters:
  | geom | the geom to connect
  | body | the body to attach to the geom

ODE_API void dGeomSetCategoryBits | ( | dGeomID | geom,
|  | unsigned long | bits
| ) |

  | Set the "category" bitfield for the given geom. The category bitfield is used by spaces to govern which geoms will interact with each other. The bitfield is guaranteed to be at least 32 bits wide. The default category values for newly created geoms have all bits set. Parameters:
  | geom | the geom to set
  | bits | the new bitfield value

ODE_API void dGeomSetCollideBits | ( | dGeomID | geom,
|  | unsigned long | bits
| ) |

  | Set the "collide" bitfield for the given geom. The collide bitfield is used by spaces to govern which geoms will interact with each other. The bitfield is guaranteed to be at least 32 bits wide. The default category values for newly created geoms have all bits set. Parameters:
  | geom | the geom to set
  | bits | the new bitfield value

ODE_API void dGeomSetData | ( | dGeomID | geom,
|  | void * | data
| ) |

  | Set the user-defined data pointer stored in the geom. Parameters:
  | geom | the geom to hold the data
  | data | the data pointer to be stored

ODE_API void dGeomSetOffsetPosition | ( | dGeomID | geom,
|  | dReal | x,
|  | dReal | y,
|  | dReal | z
| ) |

  | Set the local offset position of a geom from its body. Sets the geom's positional offset in local coordinates. After this call, the geom will be at a new position determined from the body's position and the offset. The geom must be attached to a body. If the geom did not have an offset, it is automatically created. Parameters:
  | geom | the geom to set.
  | x | the new X coordinate.
  | y | the new Y coordinate.
  | z | the new Z coordinate.

ODE_API void dGeomSetOffsetQuaternion | ( | dGeomID | geom,
|  | const dQuaternion | Q
| ) |

  | Set the local offset rotation of a geom from its body. Sets the geom's rotational offset in local coordinates. After this call, the geom will be at a new position determined from the body's position and the offset. The geom must be attached to a body. If the geom did not have an offset, it is automatically created. Parameters:
  | geom | the geom to set.
  | Q | the new rotation.

ODE_API void dGeomSetOffsetRotation | ( | dGeomID | geom,
|  | const dMatrix3 | R
| ) |

  | Set the local offset rotation matrix of a geom from its body. Sets the geom's rotational offset in local coordinates. After this call, the geom will be at a new position determined from the body's position and the offset. The geom must be attached to a body. If the geom did not have an offset, it is automatically created. Parameters:
  | geom | the geom to set.
  | R | the new rotation matrix.

ODE_API void dGeomSetOffsetWorldPosition | ( | dGeomID | geom,
|  | dReal | x,
|  | dReal | y,
|  | dReal | z
| ) |

  | Set the offset position of a geom from its body. Sets the geom's positional offset to move it to the new world coordinates. After this call, the geom will be at the world position passed in, and the offset will be the difference from the current body position. The geom must be attached to a body. If the geom did not have an offset, it is automatically created. Parameters:
  | geom | the geom to set.
  | x | the new X coordinate.
  | y | the new Y coordinate.
  | z | the new Z coordinate.

ODE_API void dGeomSetOffsetWorldQuaternion | ( | dGeomID | geom,
|  | const | dQuaternion
| ) |

  | Set the offset rotation of a geom from its body. Sets the geom's rotational offset to orient it to the new world rotation matrix. After this call, the geom will be at the world orientation passed in, and the offset will be the difference from the current body orientation. The geom must be attached to a body. If the geom did not have an offset, it is automatically created. Parameters:
  | geom | the geom to set.
  | Q | the new rotation.

ODE_API void dGeomSetOffsetWorldRotation | ( | dGeomID | geom,
|  | const dMatrix3 | R
| ) |

  | Set the offset rotation of a geom from its body. Sets the geom's rotational offset to orient it to the new world rotation matrix. After this call, the geom will be at the world orientation passed in, and the offset will be the difference from the current body orientation. The geom must be attached to a body. If the geom did not have an offset, it is automatically created. Parameters:
  | geom | the geom to set.
  | R | the new rotation matrix.

ODE_API void dGeomSetPosition | ( | dGeomID | geom,
|  | dReal | x,
|  | dReal | y,
|  | dReal | z
| ) |

  | Set the position vector of a placeable geom. If the geom is attached to a body, the body's position will also be changed. Calling this function on a non-placeable geom results in a runtime error in the debug build of ODE. Parameters:
  | geom | the geom to set.
  | x | the new X coordinate.
  | y | the new Y coordinate.
  | z | the new Z coordinate.
See also: dBodySetPosition

ODE_API void dGeomSetQuaternion | ( | dGeomID | geom,
|  | const dQuaternion | Q
| ) |

  | Set the rotation of a placeable geom. If the geom is attached to a body, the body's rotation will also be changed. Calling this function on a non-placeable geom results in a runtime error in the debug build of ODE. Parameters:
  | geom | the geom to set.
  | Q | the new rotation.
See also: dBodySetQuaternion

ODE_API void dGeomSetRotation | ( | dGeomID | geom,
|  | const dMatrix3 | R
| ) |

  | Set the rotation matrix of a placeable geom. If the geom is attached to a body, the body's rotation will also be changed. Calling this function on a non-placeable geom results in a runtime error in the debug build of ODE. Parameters:
  | geom | the geom to set.
  | R | the new rotation matrix.
See also: dBodySetRotation