DigitalSpaces::DIPhysicsCollision Struct Reference
[Physics]

#include <Physics_Collision.h>

Inherits DigitalSpaces::DIObjectBase.


Detailed Description

This interface contains information about a collision, and access to the DIPhysicsMaterial to change how the simulation will respond to the collision.

To get access to this information, your implementation needs to have registered with DIPhysics as a DIPhysicsShapeCollisionListener.


Public Member Functions

void GetPosition (out_Vector3f *pos)
 Retreive the position of the collision.
void GetNormal (out_Vector3f *norm)
 Retreive the normal of the collision.
float GetPenetration ()
 Retreive the distance which the colliding shapes are penetrating.
DIPhysicsShapeGetShape ()
 Returns one of the shapes used in the collision.
DIPhysicsShapeGetOtherShape ()
 Returns one of the shapes used in the collision.
DIPhysicsMaterialGetMaterial ()
 Returns the material used to descibe the potential reaction (contact) that will occur due to this collision.

Member Function Documentation

void DigitalSpaces::DIPhysicsCollision::GetPosition ( out_Vector3f pos  ) 

Retreive the position of the collision.

Parameters:
[out] pos Position of the collision, in world co-ordinates.

void DigitalSpaces::DIPhysicsCollision::GetNormal ( out_Vector3f norm  ) 

Retreive the normal of the collision.

The normal of the collision is the direction between the two shapes. It is the vector/line along which the penetration (as returned from GetPenetration ) is measured.

Parameters:
[out] norm Vector to contain the normal vector of the collision. In world co-ordinates.

float DigitalSpaces::DIPhysicsCollision::GetPenetration (  ) 

Retreive the distance which the colliding shapes are penetrating.

In theory a value of 0 is possible, meaning the objects are resting against each other. However this does not occur in practice, and objects at "rest" will be slightly interpenetrating.

Returns:
Penetration distance, ranges from 0.0 to the size of the objects.

DIPhysicsShape* DigitalSpaces::DIPhysicsCollision::GetShape (  ) 

Returns one of the shapes used in the collision.

There is no requirement on how the implementation decides which of the shapes should be returned by this function and which by GetOtherShape. However, the value retreived by GetNormal should be pointing out from the shape returned by this function.

Todo:
Check this is what the current implementation is doing.

DIPhysicsShape* DigitalSpaces::DIPhysicsCollision::GetOtherShape (  ) 

Returns one of the shapes used in the collision.

See also:
GetShape

DIPhysicsMaterial* DigitalSpaces::DIPhysicsCollision::GetMaterial (  ) 

Returns the material used to descibe the potential reaction (contact) that will occur due to this collision.

The DIPhysicsShapeCollisionListener implementation can use this to change every aspect about how the simulation will react to the collision, including ignoring it and allowing continuing penetration.


The documentation for this struct was generated from the following file:

Generated on Sun Aug 31 17:46:29 2008 for Digital Spaces by  doxygen 1.5.6