CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

iCollideSystem Struct Reference

This is the Collide plug-in. More...

#include <collider.h>

Inheritance diagram for iCollideSystem:

iBase List of all members.

Public Methods

virtual csPtr< iColliderCreateCollider (iPolygonMesh *mesh)=0
 Create an iCollider for the given mesh geometry. More...

virtual csPtr< iColliderCreateSphereCollider (iMeshObject *sphere)=0
 Create an iPrimSphereCollider for the given sphere geometry. More...

virtual csPtr< iColliderCreateBoxCollider (iMeshObject *box)=0
 Create an iPrimBoxCollider for the given box geometry. More...

virtual bool Collide (iCollider *collider1, const csReversibleTransform *trans1, iCollider *collider2, const csReversibleTransform *trans2)=0
 Test collision between two colliders. More...

virtual csCollisionPairGetCollisionPairs ()=0
 Get pointer to current array of collision pairs. More...

virtual int GetCollisionPairCount ()=0
 Get number of collision pairs in array. More...

virtual void ResetCollisionPairs ()=0
 Reset the array with collision pairs. More...

virtual void SetOneHitOnly (bool o)=0
 Indicate if we are interested only in the first hit that is found. More...

virtual bool GetOneHitOnly ()=0
 Return true if this CD system will only return the first hit that is found. More...

virtual int CollidePath (iCollider *collider, const csReversibleTransform *trans, csVector3 &newpos, int num_colliders, iCollider **colliders, csReversibleTransform **transforms)=0
 Test if an object can move to a new position. More...


Detailed Description

This is the Collide plug-in.

This plugin is a factory for creating iCollider entities. A collider represents an entity in the collision detection world. It uses the geometry data as given by iPolygonMesh.

Definition at line 57 of file ivaria/collider.h.


Member Function Documentation

virtual bool iCollideSystem::Collide iCollider   collider1,
const csReversibleTransform   trans1,
iCollider   collider2,
const csReversibleTransform   trans2
[pure virtual]
 

Test collision between two colliders.

This is only supported for iCollider objects created by this plugin. Returns false if no collision or else true. The collisions will be added to the collision pair array that you can query with GetCollisionPairs and reset/clear with ResetCollisionPairs. Every call to Collide will add to that array.

virtual int iCollideSystem::CollidePath iCollider   collider,
const csReversibleTransform   trans,
csVector3   newpos,
int    num_colliders,
iCollider **    colliders,
csReversibleTransform **    transforms
[pure virtual]
 

Test if an object can move to a new position.

The new position vector will be modified to reflect the maximum new position that the object could move to without colliding with something. This function will return:

  • -1 if the object could not move at all (i.e. stuck at start position).
  • 0 if the object could not move fully to the desired position.
  • 1 if the object can move unhindered to the end position.

This function will reset the collision pair array. If there was a collision along the way the array will contain the information for the first collision preventing movement.

The given transform should be the transform of the object corresponding with the old position. 'colliders' and 'transforms' should be arrays with 'num_colliders' elements for all the objects that we should test against.

virtual csPtr<iCollider> iCollideSystem::CreateBoxCollider iMeshObject   box [pure virtual]
 

Create an iPrimBoxCollider for the given box geometry.

virtual csPtr<iCollider> iCollideSystem::CreateCollider iPolygonMesh   mesh [pure virtual]
 

Create an iCollider for the given mesh geometry.

virtual csPtr<iCollider> iCollideSystem::CreateSphereCollider iMeshObject   sphere [pure virtual]
 

Create an iPrimSphereCollider for the given sphere geometry.

virtual int iCollideSystem::GetCollisionPairCount   [pure virtual]
 

Get number of collision pairs in array.

virtual csCollisionPair* iCollideSystem::GetCollisionPairs   [pure virtual]
 

Get pointer to current array of collision pairs.

This array will grow with every call to Collide until you clear it using 'ResetCollisionPairs'.

virtual bool iCollideSystem::GetOneHitOnly   [pure virtual]
 

Return true if this CD system will only return the first hit that is found.

For CD systems that support multiple hits this will return the value set by the SetOneHitOnly() function. For CD systems that support one hit only this will always return true.

virtual void iCollideSystem::ResetCollisionPairs   [pure virtual]
 

Reset the array with collision pairs.

virtual void iCollideSystem::SetOneHitOnly bool    o [pure virtual]
 

Indicate if we are interested only in the first hit that is found.

This is only valid for CD algorithms that actually allow the detection of multiple CD hit points.


The documentation for this struct was generated from the following file:
Generated for Crystal Space by doxygen 1.2.14