Open Dynamics Engine
|
Modules | |
Sphere Class | |
Box Class | |
Classes | |
struct | dContactGeom |
Describe the contact point between two geoms. More... | |
Typedefs | |
typedef dReal | dHeightfieldGetHeight(void *p_user_data, int x, int z) |
Callback prototype. More... | |
typedef void | dNearCallback(void *data, dGeomID o1, dGeomID o2) |
User callback for geom-geom collision testing. More... | |
typedef struct dContactGeom | dContactGeom |
Describe the contact point between two geoms. More... | |
Functions | |
ODE_API void | dGeomDestroy (dGeomID geom) |
Destroy a geom, removing it from any space. More... | |
ODE_API void | dGeomSetData (dGeomID geom, void *data) |
Set the user-defined data pointer stored in the geom. More... | |
ODE_API void * | dGeomGetData (dGeomID geom) |
Get the user-defined data pointer stored in the geom. More... | |
ODE_API void | dGeomSetBody (dGeomID geom, dBodyID body) |
Set the body associated with a placeable geom. More... | |
ODE_API dBodyID | dGeomGetBody (dGeomID geom) |
Get the body associated with a placeable geom. More... | |
ODE_API void | dGeomSetPosition (dGeomID geom, dReal x, dReal y, dReal z) |
Set the position vector of a placeable geom. More... | |
ODE_API void | dGeomSetRotation (dGeomID geom, const dMatrix3 R) |
Set the rotation matrix of a placeable geom. More... | |
ODE_API void | dGeomSetQuaternion (dGeomID geom, const dQuaternion Q) |
Set the rotation of a placeable geom. More... | |
ODE_API const dReal * | dGeomGetPosition (dGeomID geom) |
Get the position vector of a placeable geom. More... | |
ODE_API void | dGeomCopyPosition (dGeomID geom, dVector3 pos) |
Copy the position of a geom into a vector. More... | |
ODE_API const dReal * | dGeomGetRotation (dGeomID geom) |
Get the rotation matrix of a placeable geom. More... | |
ODE_API void | dGeomCopyRotation (dGeomID geom, dMatrix3 R) |
Get the rotation matrix of a placeable geom. More... | |
ODE_API void | dGeomGetQuaternion (dGeomID geom, dQuaternion result) |
Get the rotation quaternion of a placeable geom. More... | |
ODE_API void | dGeomGetAABB (dGeomID geom, dReal aabb[6]) |
Return the axis-aligned bounding box. More... | |
ODE_API int | dGeomIsSpace (dGeomID geom) |
Determing if a geom is a space. More... | |
ODE_API dSpaceID | dGeomGetSpace (dGeomID) |
Query for the space containing a particular geom. More... | |
ODE_API int | dGeomGetClass (dGeomID geom) |
Given a geom, this returns its class. More... | |
ODE_API void | dGeomSetCategoryBits (dGeomID geom, unsigned long bits) |
Set the "category" bitfield for the given geom. More... | |
ODE_API void | dGeomSetCollideBits (dGeomID geom, unsigned long bits) |
Set the "collide" bitfield for the given geom. More... | |
ODE_API unsigned long | dGeomGetCategoryBits (dGeomID) |
Get the "category" bitfield for the given geom. More... | |
ODE_API unsigned long | dGeomGetCollideBits (dGeomID) |
Get the "collide" bitfield for the given geom. More... | |
ODE_API void | dGeomEnable (dGeomID geom) |
Enable a geom. More... | |
ODE_API void | dGeomDisable (dGeomID geom) |
Disable a geom. More... | |
ODE_API int | dGeomIsEnabled (dGeomID geom) |
Check to see if a geom is enabled. More... | |
ODE_API int | dGeomLowLevelControl (dGeomID geom, int controlClass, int controlCode, void *dataValue, int *dataSize) |
Execute low level control operation for geometry. More... | |
ODE_API void | dGeomGetRelPointPos (dGeomID geom, dReal px, dReal py, dReal pz, dVector3 result) |
Get world position of a relative point on geom. More... | |
ODE_API void | dGeomGetPosRelPoint (dGeomID geom, dReal px, dReal py, dReal pz, dVector3 result) |
takes a point in global coordinates and returns the point's position in geom-relative coordinates. More... | |
ODE_API void | dGeomVectorToWorld (dGeomID geom, dReal px, dReal py, dReal pz, dVector3 result) |
Convert from geom-local to world coordinates. More... | |
ODE_API void | dGeomVectorFromWorld (dGeomID geom, dReal px, dReal py, dReal pz, dVector3 result) |
Convert from world to geom-local coordinates. More... | |
ODE_API void | dGeomSetOffsetPosition (dGeomID geom, dReal x, dReal y, dReal z) |
Set the local offset position of a geom from its body. More... | |
ODE_API void | dGeomSetOffsetRotation (dGeomID geom, const dMatrix3 R) |
Set the local offset rotation matrix of a geom from its body. More... | |
ODE_API void | dGeomSetOffsetQuaternion (dGeomID geom, const dQuaternion Q) |
Set the local offset rotation of a geom from its body. More... | |
ODE_API void | dGeomSetOffsetWorldPosition (dGeomID geom, dReal x, dReal y, dReal z) |
Set the offset position of a geom from its body. More... | |
ODE_API void | dGeomSetOffsetWorldRotation (dGeomID geom, const dMatrix3 R) |
Set the offset rotation of a geom from its body. More... | |
ODE_API void | dGeomSetOffsetWorldQuaternion (dGeomID geom, const dQuaternion) |
Set the offset rotation of a geom from its body. More... | |
ODE_API void | dGeomClearOffset (dGeomID geom) |
Clear any offset from the geom. More... | |
ODE_API int | dGeomIsOffset (dGeomID geom) |
Check to see whether the geom has an offset. More... | |
ODE_API const dReal * | dGeomGetOffsetPosition (dGeomID geom) |
Get the offset position vector of a geom. More... | |
ODE_API void | dGeomCopyOffsetPosition (dGeomID geom, dVector3 pos) |
Copy the offset position vector of a geom. More... | |
ODE_API const dReal * | dGeomGetOffsetRotation (dGeomID geom) |
Get the offset rotation matrix of a geom. More... | |
ODE_API void | dGeomCopyOffsetRotation (dGeomID geom, dMatrix3 R) |
Copy the offset rotation matrix of a geom. More... | |
ODE_API void | dGeomGetOffsetQuaternion (dGeomID geom, dQuaternion result) |
Get the offset rotation quaternion of a geom. More... | |
ODE_API int | dCollide (dGeomID o1, dGeomID o2, int flags, dContactGeom *contact, int skip) |
Given two geoms o1 and o2 that potentially intersect, generate contact information for them. More... | |
ODE_API void | dSpaceCollide (dSpaceID space, void *data, dNearCallback *callback) |
Determines which pairs of geoms in a space may potentially intersect, and calls the callback function for each candidate pair. More... | |
ODE_API void | dSpaceCollide2 (dGeomID space1, dGeomID space2, void *data, dNearCallback *callback) |
Determines which geoms from one space may potentially intersect with geoms from another space, and calls the callback function for each candidate pair. More... | |
ODE_API dGeomID | dCreateHeightfield (dSpaceID space, dHeightfieldDataID data, int bPlaceable) |
Creates a heightfield geom. More... | |
ODE_API dHeightfieldDataID | dGeomHeightfieldDataCreate (void) |
Creates a new empty dHeightfieldDataID. More... | |
ODE_API void | dGeomHeightfieldDataDestroy (dHeightfieldDataID d) |
Destroys a dHeightfieldDataID. More... | |
ODE_API void | dGeomHeightfieldDataBuildCallback (dHeightfieldDataID d, void *pUserData, dHeightfieldGetHeight *pCallback, dReal width, dReal depth, int widthSamples, int depthSamples, dReal scale, dReal offset, dReal thickness, int bWrap) |
Configures a dHeightfieldDataID to use a callback to retrieve height data. More... | |
ODE_API void | dGeomHeightfieldDataBuildByte (dHeightfieldDataID d, const unsigned char *pHeightData, int bCopyHeightData, dReal width, dReal depth, int widthSamples, int depthSamples, dReal scale, dReal offset, dReal thickness, int bWrap) |
Configures a dHeightfieldDataID to use height data in byte format. More... | |
ODE_API void | dGeomHeightfieldDataBuildShort (dHeightfieldDataID d, const short *pHeightData, int bCopyHeightData, dReal width, dReal depth, int widthSamples, int depthSamples, dReal scale, dReal offset, dReal thickness, int bWrap) |
Configures a dHeightfieldDataID to use height data in short format. More... | |
ODE_API void | dGeomHeightfieldDataBuildSingle (dHeightfieldDataID d, const float *pHeightData, int bCopyHeightData, dReal width, dReal depth, int widthSamples, int depthSamples, dReal scale, dReal offset, dReal thickness, int bWrap) |
Configures a dHeightfieldDataID to use height data in single precision floating point format. More... | |
ODE_API void | dGeomHeightfieldDataBuildDouble (dHeightfieldDataID d, const double *pHeightData, int bCopyHeightData, dReal width, dReal depth, int widthSamples, int depthSamples, dReal scale, dReal offset, dReal thickness, int bWrap) |
Configures a dHeightfieldDataID to use height data in double precision floating point format. More... | |
ODE_API void | dGeomHeightfieldDataSetBounds (dHeightfieldDataID d, dReal minHeight, dReal maxHeight) |
Manually set the minimum and maximum height bounds. More... | |
ODE_API void | dGeomHeightfieldSetHeightfieldData (dGeomID g, dHeightfieldDataID d) |
Assigns a dHeightfieldDataID to a heightfield geom. More... | |
ODE_API dHeightfieldDataID | dGeomHeightfieldGetHeightfieldData (dGeomID g) |
Gets the dHeightfieldDataID bound to a heightfield geom. More... | |
ODE_API void | dSetColliderOverride (int i, int j, dColliderFn *fn) |
Sets a custom collider function for two geom classes. More... | |
ODE_API void | dSpaceSetSublevel (dSpaceID space, int sublevel) |
Sets sublevel value for a space. More... | |
ODE_API int | dSpaceGetSublevel (dSpaceID space) |
Gets sublevel value of a space. More... | |
ODE_API void | dSpaceSetManualCleanup (dSpaceID space, int mode) |
Sets manual cleanup flag for a space. More... | |
ODE_API int | dSpaceGetManualCleanup (dSpaceID space) |
Get manual cleanup flag of a space. More... | |
ODE_API int | dSpaceGetClass (dSpaceID space) |
Given a space, this returns its class. More... | |
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.
typedef struct dContactGeom dContactGeom |
Describe the contact point between two geoms.
If two bodies touch, or if a body touches a static feature in its environment, the contact is represented by one or more "contact points", described by dContactGeom.
The convention is that if body 1 is moved along the normal vector by a distance depth (or equivalently if body 2 is moved the same distance in the opposite direction) then the contact depth will be reduced to zero. This means that the normal vector points "in" to body 1.
typedef dReal dHeightfieldGetHeight(void *p_user_data, int x, int z) |
Callback prototype.
Used by the callback heightfield data type to sample a height for a given cell position.
p_user_data | User data specified when creating the dHeightfieldDataID |
x | The index of a sample in the local x axis. It is a value in the range zero to ( nWidthSamples - 1 ). |
x | The index of a sample in the local z axis. It is a value in the range zero to ( nDepthSamples - 1 ). |
User callback for geom-geom collision testing.
data | The user data object, as passed to dSpaceCollide. |
o1 | The first geom being tested. |
o2 | The second geom being test. |
ODE_API int dCollide | ( | dGeomID | o1, |
dGeomID | o2, | ||
int | flags, | ||
dContactGeom * | contact, | ||
int | skip | ||
) |
Given two geoms o1 and o2 that potentially intersect, generate contact information for them.
Internally, this just calls the correct class-specific collision functions for o1 and o2.
o1 | The first geom to test. |
o2 | The second geom to test. |
flags | The flags specify how contacts should be generated if the geoms touch. The lower 16 bits of flags is an integer that specifies the maximum number of contact points to generate. You must ask for at least one contact. Additionally, following bits may be set: CONTACTS_UNIMPORTANT – just generate any contacts (skip contact refining). All other bits in flags must be set to zero. In the future the other bits may be used to select from different contact generation strategies. |
contact | Points to an array of dContactGeom structures. The array must be able to hold at least the maximum number of contacts. These dContactGeom structures may be embedded within larger structures in the array – the skip parameter is the byte offset from one dContactGeom to the next in the array. If skip is sizeof(dContactGeom) then contact points to a normal (C-style) array. It is an error for skip to be smaller than sizeof(dContactGeom). |
ODE_API dGeomID dCreateHeightfield | ( | dSpaceID | space, |
dHeightfieldDataID | data, | ||
int | bPlaceable | ||
) |
Creates a heightfield geom.
Uses the information in the given dHeightfieldDataID to construct a geom representing a heightfield in a collision space.
space | The space to add the geom to. |
data | The dHeightfieldDataID created by dGeomHeightfieldDataCreate and setup by dGeomHeightfieldDataBuildCallback, dGeomHeightfieldDataBuildByte, dGeomHeightfieldDataBuildShort or dGeomHeightfieldDataBuildFloat. |
bPlaceable | If non-zero this geom can be transformed in the world using the usual functions such as dGeomSetPosition and dGeomSetRotation. If the geom is not set as placeable, then it uses a fixed orientation where the global y axis represents the dynamic 'height' of the heightfield. |
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.
geom | the geom to have its offset destroyed. |
ODE_API void dGeomCopyOffsetPosition | ( | dGeomID | geom, |
dVector3 | pos | ||
) |
Copy 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.
geom | the geom to query. |
pos | returns the offset position |
ODE_API void dGeomCopyOffsetRotation | ( | dGeomID | geom, |
dMatrix3 | R | ||
) |
Copy the offset rotation matrix of a geom.
Returns the rotational offset of the geom in local coordinates. If the geom has no offset, this function returns the identity matrix.
geom | the geom to query. |
R | returns the rotation matrix. |
ODE_API void dGeomCopyPosition | ( | dGeomID | geom, |
dVector3 | pos | ||
) |
Copy the position of a geom into a vector.
geom | the geom to query |
pos | a copy of the geom position |
ODE_API void dGeomCopyRotation | ( | dGeomID | geom, |
dMatrix3 | R | ||
) |
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.
geom | the geom to query. |
R | a copy of the geom rotation |
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.
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.
geom | the geom to disable |
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.
geom | the geom to enable |
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.
geom | the geom to query |
aabb | the returned bounding box |
Get the body associated with a placeable geom.
geom | the geom to query. |
ODE_API unsigned long dGeomGetCategoryBits | ( | dGeomID | ) |
Get the "category" bitfield for the given geom.
geom | the geom to set |
bits | the new bitfield value |
ODE_API int dGeomGetClass | ( | dGeomID | geom | ) |
Given a geom, this returns its class.
The ODE classes are:
User-defined class will return their own number.
geom | the geom to query |
ODE_API unsigned long dGeomGetCollideBits | ( | dGeomID | ) |
Get the "collide" bitfield for the given geom.
geom | the geom to set |
bits | the new bitfield value |
ODE_API void* dGeomGetData | ( | dGeomID | geom | ) |
Get the user-defined data pointer stored in the geom.
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.
geom | the geom to query. |
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.
geom | the geom to query. |
result | a copy of the rotation quaternion. |
ODE_API const dReal* dGeomGetOffsetRotation | ( | dGeomID | geom | ) |
Get the offset rotation matrix of a geom.
Returns the rotational offset of the geom in local coordinates. If the geom has no offset, this function returns the identity matrix.
geom | the geom to query. |
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.
geom | the geom to query. |
ODE_API void dGeomGetPosRelPoint | ( | dGeomID | geom, |
dReal | px, | ||
dReal | py, | ||
dReal | pz, | ||
dVector3 | result | ||
) |
takes a point in global coordinates and returns the point's position in geom-relative coordinates.
Calling this function on a non-placeable geom results in the same point being returned.
result | will contain the result. |
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.
geom | the geom to query. |
result | a copy of the rotation quaternion. |
ODE_API void dGeomGetRelPointPos | ( | dGeomID | geom, |
dReal | px, | ||
dReal | py, | ||
dReal | pz, | ||
dVector3 | result | ||
) |
Get world position of a relative point on geom.
Calling this function on a non-placeable geom results in the same point being returned.
result | will contain the result. |
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.
geom | the geom to query. |
Query for the space containing a particular geom.
geom | the geom to query |
ODE_API void dGeomHeightfieldDataBuildByte | ( | dHeightfieldDataID | d, |
const unsigned char * | pHeightData, | ||
int | bCopyHeightData, | ||
dReal | width, | ||
dReal | depth, | ||
int | widthSamples, | ||
int | depthSamples, | ||
dReal | scale, | ||
dReal | offset, | ||
dReal | thickness, | ||
int | bWrap | ||
) |
Configures a dHeightfieldDataID to use height data in byte format.
Before a dHeightfieldDataID can be used by a geom it must be configured to specify the format of the height data. This call specifies that the heightfield data is stored as a rectangular array of bytes (8 bit unsigned) representing the height at each sample point.
d | A new dHeightfieldDataID created by dGeomHeightfieldDataCreate |
pHeightData | A pointer to the height data. |
bCopyHeightData | When non-zero the height data is copied to an internal store. When zero the height data is accessed by reference and so must persist throughout the lifetime of the heightfield. |
width | Specifies the total 'width' of the heightfield along the geom's local x axis. |
depth | Specifies the total 'depth' of the heightfield along the geom's local z axis. |
widthSamples | Specifies the number of vertices to sample along the width of the heightfield. Each vertex has a corresponding height value which forms the overall shape. Naturally this value must be at least two or more. |
depthSamples | Specifies the number of vertices to sample along the depth of the heightfield. |
scale | A uniform scale applied to all raw height data. |
offset | An offset applied to the scaled height data. |
thickness | A value subtracted from the lowest height value which in effect adds an additional cuboid to the base of the heightfield. This is used to prevent geoms from looping under the desired terrain and not registering as a collision. Note that the thickness is not affected by the scale or offset parameters. |
bWrap | If non-zero the heightfield will infinitely tile in both directions along the local x and z axes. If zero the heightfield is bounded from zero to width in the local x axis, and zero to depth in the local z axis. |
ODE_API void dGeomHeightfieldDataBuildCallback | ( | dHeightfieldDataID | d, |
void * | pUserData, | ||
dHeightfieldGetHeight * | pCallback, | ||
dReal | width, | ||
dReal | depth, | ||
int | widthSamples, | ||
int | depthSamples, | ||
dReal | scale, | ||
dReal | offset, | ||
dReal | thickness, | ||
int | bWrap | ||
) |
Configures a dHeightfieldDataID to use a callback to retrieve height data.
Before a dHeightfieldDataID can be used by a geom it must be configured to specify the format of the height data. This call specifies that the heightfield data is computed by the user and it should use the given callback when determining the height of a given element of it's shape.
d | A new dHeightfieldDataID created by dGeomHeightfieldDataCreate |
width | Specifies the total 'width' of the heightfield along the geom's local x axis. |
depth | Specifies the total 'depth' of the heightfield along the geom's local z axis. |
widthSamples | Specifies the number of vertices to sample along the width of the heightfield. Each vertex has a corresponding height value which forms the overall shape. Naturally this value must be at least two or more. |
depthSamples | Specifies the number of vertices to sample along the depth of the heightfield. |
scale | A uniform scale applied to all raw height data. |
offset | An offset applied to the scaled height data. |
thickness | A value subtracted from the lowest height value which in effect adds an additional cuboid to the base of the heightfield. This is used to prevent geoms from looping under the desired terrain and not registering as a collision. Note that the thickness is not affected by the scale or offset parameters. |
bWrap | If non-zero the heightfield will infinitely tile in both directions along the local x and z axes. If zero the heightfield is bounded from zero to width in the local x axis, and zero to depth in the local z axis. |
ODE_API void dGeomHeightfieldDataBuildDouble | ( | dHeightfieldDataID | d, |
const double * | pHeightData, | ||
int | bCopyHeightData, | ||
dReal | width, | ||
dReal | depth, | ||
int | widthSamples, | ||
int | depthSamples, | ||
dReal | scale, | ||
dReal | offset, | ||
dReal | thickness, | ||
int | bWrap | ||
) |
Configures a dHeightfieldDataID to use height data in double precision floating point format.
Before a dHeightfieldDataID can be used by a geom it must be configured to specify the format of the height data. This call specifies that the heightfield data is stored as a rectangular array of double precision floats representing the height at each sample point.
d | A new dHeightfieldDataID created by dGeomHeightfieldDataCreate |
pHeightData | A pointer to the height data. |
bCopyHeightData | When non-zero the height data is copied to an internal store. When zero the height data is accessed by reference and so must persist throughout the lifetime of the heightfield. |
width | Specifies the total 'width' of the heightfield along the geom's local x axis. |
depth | Specifies the total 'depth' of the heightfield along the geom's local z axis. |
widthSamples | Specifies the number of vertices to sample along the width of the heightfield. Each vertex has a corresponding height value which forms the overall shape. Naturally this value must be at least two or more. |
depthSamples | Specifies the number of vertices to sample along the depth of the heightfield. |
scale | A uniform scale applied to all raw height data. |
offset | An offset applied to the scaled height data. |
thickness | A value subtracted from the lowest height value which in effect adds an additional cuboid to the base of the heightfield. This is used to prevent geoms from looping under the desired terrain and not registering as a collision. Note that the thickness is not affected by the scale or offset parameters. |
bWrap | If non-zero the heightfield will infinitely tile in both directions along the local x and z axes. If zero the heightfield is bounded from zero to width in the local x axis, and zero to depth in the local z axis. |
ODE_API void dGeomHeightfieldDataBuildShort | ( | dHeightfieldDataID | d, |
const short * | pHeightData, | ||
int | bCopyHeightData, | ||
dReal | width, | ||
dReal | depth, | ||
int | widthSamples, | ||
int | depthSamples, | ||
dReal | scale, | ||
dReal | offset, | ||
dReal | thickness, | ||
int | bWrap | ||
) |
Configures a dHeightfieldDataID to use height data in short format.
Before a dHeightfieldDataID can be used by a geom it must be configured to specify the format of the height data. This call specifies that the heightfield data is stored as a rectangular array of shorts (16 bit signed) representing the height at each sample point.
d | A new dHeightfieldDataID created by dGeomHeightfieldDataCreate |
pHeightData | A pointer to the height data. |
bCopyHeightData | When non-zero the height data is copied to an internal store. When zero the height data is accessed by reference and so must persist throughout the lifetime of the heightfield. |
width | Specifies the total 'width' of the heightfield along the geom's local x axis. |
depth | Specifies the total 'depth' of the heightfield along the geom's local z axis. |
widthSamples | Specifies the number of vertices to sample along the width of the heightfield. Each vertex has a corresponding height value which forms the overall shape. Naturally this value must be at least two or more. |
depthSamples | Specifies the number of vertices to sample along the depth of the heightfield. |
scale | A uniform scale applied to all raw height data. |
offset | An offset applied to the scaled height data. |
thickness | A value subtracted from the lowest height value which in effect adds an additional cuboid to the base of the heightfield. This is used to prevent geoms from looping under the desired terrain and not registering as a collision. Note that the thickness is not affected by the scale or offset parameters. |
bWrap | If non-zero the heightfield will infinitely tile in both directions along the local x and z axes. If zero the heightfield is bounded from zero to width in the local x axis, and zero to depth in the local z axis. |
ODE_API void dGeomHeightfieldDataBuildSingle | ( | dHeightfieldDataID | d, |
const float * | pHeightData, | ||
int | bCopyHeightData, | ||
dReal | width, | ||
dReal | depth, | ||
int | widthSamples, | ||
int | depthSamples, | ||
dReal | scale, | ||
dReal | offset, | ||
dReal | thickness, | ||
int | bWrap | ||
) |
Configures a dHeightfieldDataID to use height data in single precision floating point format.
Before a dHeightfieldDataID can be used by a geom it must be configured to specify the format of the height data. This call specifies that the heightfield data is stored as a rectangular array of single precision floats representing the height at each sample point.
d | A new dHeightfieldDataID created by dGeomHeightfieldDataCreate |
pHeightData | A pointer to the height data. |
bCopyHeightData | When non-zero the height data is copied to an internal store. When zero the height data is accessed by reference and so must persist throughout the lifetime of the heightfield. |
width | Specifies the total 'width' of the heightfield along the geom's local x axis. |
depth | Specifies the total 'depth' of the heightfield along the geom's local z axis. |
widthSamples | Specifies the number of vertices to sample along the width of the heightfield. Each vertex has a corresponding height value which forms the overall shape. Naturally this value must be at least two or more. |
depthSamples | Specifies the number of vertices to sample along the depth of the heightfield. |
scale | A uniform scale applied to all raw height data. |
offset | An offset applied to the scaled height data. |
thickness | A value subtracted from the lowest height value which in effect adds an additional cuboid to the base of the heightfield. This is used to prevent geoms from looping under the desired terrain and not registering as a collision. Note that the thickness is not affected by the scale or offset parameters. |
bWrap | If non-zero the heightfield will infinitely tile in both directions along the local x and z axes. If zero the heightfield is bounded from zero to width in the local x axis, and zero to depth in the local z axis. |
ODE_API dHeightfieldDataID dGeomHeightfieldDataCreate | ( | void | ) |
Creates a new empty dHeightfieldDataID.
Allocates a new dHeightfieldDataID and returns it. You must call dGeomHeightfieldDataDestroy to destroy it after the geom has been removed. The dHeightfieldDataID value is used when specifying a data format type.
ODE_API void dGeomHeightfieldDataDestroy | ( | dHeightfieldDataID | d | ) |
Destroys a dHeightfieldDataID.
Deallocates a given dHeightfieldDataID and all managed resources.
d | A dHeightfieldDataID created by dGeomHeightfieldDataCreate |
ODE_API void dGeomHeightfieldDataSetBounds | ( | dHeightfieldDataID | d, |
dReal | minHeight, | ||
dReal | maxHeight | ||
) |
Manually set the minimum and maximum height bounds.
This call allows you to set explicit min / max values after initial creation typically for callback heightfields which default to +/- infinity, or those whose data has changed. This must be set prior to binding with a geom, as the the AABB is not recomputed after it's first generation.
d | A dHeightfieldDataID created by dGeomHeightfieldDataCreate |
min_height | The new minimum height value. Scale, offset and thickness is then applied. |
max_height | The new maximum height value. Scale and offset is then applied. |
ODE_API dHeightfieldDataID dGeomHeightfieldGetHeightfieldData | ( | dGeomID | g | ) |
Gets the dHeightfieldDataID bound to a heightfield geom.
Returns the dHeightfieldDataID associated with a heightfield geom.
g | A geom created by dCreateHeightfield |
ODE_API void dGeomHeightfieldSetHeightfieldData | ( | dGeomID | g, |
dHeightfieldDataID | d | ||
) |
Assigns a dHeightfieldDataID to a heightfield geom.
Associates the given dHeightfieldDataID with a heightfield geom. This is done without affecting the GEOM_PLACEABLE flag.
g | A geom created by dCreateHeightfield |
d | A dHeightfieldDataID created by dGeomHeightfieldDataCreate |
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.
geom | the geom to query |
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.
geom | the geom to query. |
ODE_API int dGeomIsSpace | ( | dGeomID | geom | ) |
Determing if a geom is a space.
geom | the geom to query |
Referenced by dSpaceGetManualCleanup(), dSpaceGetSublevel(), dSpaceSetManualCleanup(), and dSpaceSetSublevel().
ODE_API int dGeomLowLevelControl | ( | dGeomID | geom, |
int | controlClass, | ||
int | controlCode, | ||
void * | dataValue, | ||
int * | dataSize | ||
) |
Execute low level control operation for geometry.
The variable the dataSize points to must be initialized before the call. If the size does not match the one expected for the control class/code function changes it to the size expected and returns failure. This implies the function can be called with NULL data and zero size to test if control class/code is supported and obtain required data size for it.
dGeomCommonAnyControlCode applies to any control class and returns success if at least one control code is available for the given class with given geom.
Currently there are the folliwing control classes supported:
For dGeomColliderControlClass there are the following codes available:
geom | the geom to control |
controlClass | the control class |
controlCode | the control code for the class |
dataValue | the control argument pointer |
dataSize | the control argument size provided or expected |
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
geom | the geom to set. |
x | the new X coordinate. |
y | the new Y coordinate. |
z | the new Z coordinate. |
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.
geom | the geom to set. |
Q | the new rotation. |
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.
geom | the geom to set. |
R | the new rotation matrix. |
ODE_API void dGeomVectorFromWorld | ( | dGeomID | geom, |
dReal | px, | ||
dReal | py, | ||
dReal | pz, | ||
dVector3 | result | ||
) |
Convert from world to geom-local coordinates.
Calling this function on a non-placeable geom results in the same vector being returned.
result | will contain the result. |
ODE_API void dGeomVectorToWorld | ( | dGeomID | geom, |
dReal | px, | ||
dReal | py, | ||
dReal | pz, | ||
dVector3 | result | ||
) |
Convert from geom-local to world coordinates.
Calling this function on a non-placeable geom results in the same vector being returned.
result | will contain the result. |
ODE_API void dSetColliderOverride | ( | int | i, |
int | j, | ||
dColliderFn * | fn | ||
) |
Sets a custom collider function for two geom classes.
i | The first geom class handled by this collider |
j | The second geom class handled by this collider |
fn | The collider function to use to determine collisions. |
ODE_API void dSpaceCollide | ( | dSpaceID | space, |
void * | data, | ||
dNearCallback * | callback | ||
) |
Determines which pairs of geoms in a space may potentially intersect, and calls the callback function for each candidate pair.
space | The space to test. |
data | Passed from dSpaceCollide directly to the callback function. Its meaning is user defined. The o1 and o2 arguments are the geoms that may be near each other. |
callback | A callback function is of type dNearCallback. |
ODE_API void dSpaceCollide2 | ( | dGeomID | space1, |
dGeomID | space2, | ||
void * | data, | ||
dNearCallback * | callback | ||
) |
Determines which geoms from one space may potentially intersect with geoms from another space, and calls the callback function for each candidate pair.
space1 | The first space to test. |
space2 | The second space to test. |
data | Passed from dSpaceCollide directly to the callback function. Its meaning is user defined. The o1 and o2 arguments are the geoms that may be near each other. |
callback | A callback function is of type dNearCallback. |
ODE_API int dSpaceGetClass | ( | dSpaceID | space | ) |
Given a space, this returns its class.
The ODE classes are:
The class id not defined by the user should be between dFirstSpaceClass and dLastSpaceClass.
User-defined class will return their own number.
space | the space to query |
ODE_API int dSpaceGetManualCleanup | ( | dSpaceID | space | ) |
Get manual cleanup flag of a space.
Manual cleanup flag marks a space space as eligible for manual thread data cleanup. See dSpaceSetManualCleanup
for more details.
space | the space to query |
References dGeomIsSpace().
ODE_API int dSpaceGetSublevel | ( | dSpaceID | space | ) |
Gets sublevel value of a space.
Sublevel affects how the space is handled in dSpaceCollide2 when it is collided with another space. See dSpaceSetSublevel
for more details.
space | the space to query |
References dGeomIsSpace().
ODE_API void dSpaceSetManualCleanup | ( | dSpaceID | space, |
int | mode | ||
) |
Sets manual cleanup flag for a space.
Manual cleanup flag marks a space as eligible for manual thread data cleanup. This function should be called for every space object right after creation in case if ODE has been initialized with dInitFlagManualThreadCleanup
flag.
Failure to set manual cleanup flag for a space may lead to some resources remaining leaked until the program exit.
space | the space to modify |
mode | 1 for manual cleanup mode and 0 for default cleanup mode |
References dGeomIsSpace().
ODE_API void dSpaceSetSublevel | ( | dSpaceID | space, |
int | sublevel | ||
) |
Sets sublevel value for a space.
Sublevel affects how the space is handled in dSpaceCollide2 when it is collided with another space. If sublevels of both spaces match, the function iterates geometries of both spaces and collides them with each other. If sublevel of one space is greater than the sublevel of another one, only the geometries of the space with greater sublevel are iterated, another space is passed into collision callback as a geometry itself. By default all the spaces are assigned zero sublevel.
space | the space to modify |
sublevel | the sublevel value to be assigned |
References dGeomIsSpace().