DigitalSpaces::DIPhysicsShape Struct Reference
[Physics]

#include <Physics_Shape.h>

Inherits DigitalSpaces::DIObjectBase.


Detailed Description

DInterface representing physics shapes.

These are created through DIPhysicsWorld::CreateShape To set the type of shape, call DIPhysicsBase::BeginSetup with the type of shape you want. Calling DIPhysicsBase::BeginSetup with no paramaters will not create a valid shape.

Supported shape types should include, and include the properties of:

All shapes should also support:

Any implementation may provide more, but these are the minimum expected types.


Public Member Functions

void SetPosition (in_Vector3f *vecPosition)
 Set the position of the shape.
void SetOrientation (in_Quaternionf *quatRot)
 Set the orientation of the shape.
void SetGroup (unsigned char cGroup)
 Set the collision group the shape is part of.
void AddIndex (unsigned uIndex)
 Add an index to a mesh shape.
void AddVertex (in_Vector3f *vecVertex)
 Add a vertex to a mesh shape.
void GetPosition (out_Vector3f *vecPos)
 Retreive the current position of the shape.
void GetOrientation (out_Quaternionf *quatRot)
 Retreive the current orientation of the shape.
unsigned char GetGroup ()
 Returns the current collision group, as set by SetGroup.
DIPhysicsBodyGetBody ()
 Return the body the shape is attached to.
const char * GetType ()
 Returns the sub-type of shape, as set via DIPhysicsBase::BeginSetup(const char*).

Member Function Documentation

void DigitalSpaces::DIPhysicsShape::SetPosition ( in_Vector3f vecPosition  ) 

Set the position of the shape.

This is relative to its containing body, or in world co-ordinates if not connected to a body.

Parameters:
vecPosition Vector containing the new shape position.

void DigitalSpaces::DIPhysicsShape::SetOrientation ( in_Quaternionf quatRot  ) 

Set the orientation of the shape.

This is relative to its containing body, or in world co-ordinates if not connected to a body.

Parameters:
quatRot Quaternion containing the new shape orientation.

void DigitalSpaces::DIPhysicsShape::SetGroup ( unsigned char  cGroup  ) 

Set the collision group the shape is part of.

Using a collision group is a way of simply discarding collisions between shapes. By default, if the two intersecting shapes are members of the same group, they will not create a collision.

Parameters:
cGroup Value from 0 to 31.
See also:
DIPhysicsWorld::SetGroupCollision

void DigitalSpaces::DIPhysicsShape::AddIndex ( unsigned  uIndex  ) 

Add an index to a mesh shape.

This is only applicable to a mesh type shape, and should only be called between BeginSetup and EndSetup. Calling at any other time should have no effect.

Note:
In the current implementation calling this function outside of DIPhysicsBase::BeginSetup / DIPhysicsBase::EndSetup will have no immediate effect, but might cause changes to the physics shape when calling DIPhysicsBase::Set.
The function adds an index to a vertex (added via AddVertex). Vertex indexes are zero based. Indexes should be added in sets of three, to describe each point of a mesh polygon. No optimizations (such as triangle strips) will be used.

void DigitalSpaces::DIPhysicsShape::AddVertex ( in_Vector3f vecVertex  ) 

Add a vertex to a mesh shape.

This is only applicable to a mesh type shape, and should only be called between BeginSetup and EndSetup. Calling at any other time should have no effect.

Note:
In the current implementation calling this function outside of DIPhysicsBase::BeginSetup / DIPhysicsBase::EndSetup will have no immediate effect, but might cause changes to the physics shape when calling DIPhysicsBase::Set.
Vertices added via this function are linked to form polygons using the information provided by AddIndex. Each vertex is appended to the collection of previously added vertices, and thus given an index based on the order in which they were added. For this reason, Vertices and Indexes should be set in a continuous manner, where the caller can keep track of what the vertices index will be.

Parameters:
vecVertex Position in space relative to the shapes position/orientation, as set by SetPosition and SetOrientation.

void DigitalSpaces::DIPhysicsShape::GetPosition ( out_Vector3f vecPos  ) 

Retreive the current position of the shape.

This is relative to its containing body, or in world co-ordinates if not connected to a body.

Parameters:
[out] vecPos Vector to be filled with the current shape position.

void DigitalSpaces::DIPhysicsShape::GetOrientation ( out_Quaternionf quatRot  ) 

Retreive the current orientation of the shape.

This is relative to its containing body, or in world co-ordinates if not connected to a body.

Parameters:
[out] quatRot Quaternion to be filled with the current shape orientation.

unsigned char DigitalSpaces::DIPhysicsShape::GetGroup (  ) 

Returns the current collision group, as set by SetGroup.

Returns:
Group identifier, ranges from 0 to 31.

DIPhysicsBody* DigitalSpaces::DIPhysicsShape::GetBody (  ) 

Return the body the shape is attached to.

Returns:
Interface to the shapes containing (parent) body, or NULL if the shape is not attached to a body.

const char* DigitalSpaces::DIPhysicsShape::GetType (  ) 

Returns the sub-type of shape, as set via DIPhysicsBase::BeginSetup(const char*).


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