Public Member Functions | Protected Member Functions | Friends

sp::scene::CollisionNode Class Reference
[Collision System]

#include <spCollisionNode.hpp>

Inheritance diagram for sp::scene::CollisionNode:
sp::BaseObject sp::scene::CollisionBox sp::scene::CollisionLineBased sp::scene::CollisionMesh sp::scene::CollisionPlane sp::scene::CollisionSphere sp::scene::CollisionCapsule sp::scene::CollisionCone sp::scene::CollisionCylinder

List of all members.

Public Member Functions

virtual ~CollisionNode ()
virtual s32 getSupportFlags () const =0
virtual f32 getMaxMovement () const =0
virtual void setMaterial (CollisionMaterial *Material)
 Sets the collision material.
virtual void findIntersections (const dim::line3df &Line, std::list< SIntersectionContact > &ContactList) const
virtual bool checkIntersection (const dim::line3df &Line, SIntersectionContact &Contact) const
virtual bool checkIntersection (const dim::line3df &Line, bool ExcludeCorners=false) const
virtual bool checkCollision (const CollisionNode *Rival, SCollisionContact &Contact) const
 Checks for a collision between this collision object and the rival object.
virtual bool checkCollision (const CollisionNode *Rival) const
 Checks if this collision node has any collision with the given rival collision node.
virtual void performCollisionResolving (const CollisionNode *Rival)
 Checks for a collision between this collision object and the rival object and performs collision resolving as well.
void setupTransformation (const dim::matrix4f &Matrix)
void updateTransformation ()
void setPosition (const dim::vector3df &Position, bool UpdatePrevPosition=true)
 Sets the global position of the scene node.
void setOffset (const dim::matrix4f &Matrix, bool Enable=true)
 Sets the transformation offset. This matrix will be multiplied to the scene-node's global transformation.
void updateCollisions ()
ECollisionModels getType () const
 Returns the collision model type.
void setFlags (s32 Flags)
s32 getFlags () const
 Returns teh flags for collision detection. By default COLLISIONFLAG_FULL.
SceneNodegetNode () const
 Returns a pointer to the SceneNode object.
CollisionMaterialgetMaterial () const
 Returns the collision material.
dim::vector3df getPosition () const
 Returns the global position of the scene node.
void translate (const dim::vector3df &Direction)
 Wrapper function for SceneNode::translate.
void move (const dim::vector3df &Direction)
 Wrapper function for SceneNode::move.
void turn (const dim::vector3df &Rotation)
 Wrapper function for SceneNode::turn.
void setRotation (const dim::matrix4f &Rotation)
 Sets the global rotation of the scene node.
dim::matrix4f getRotation () const
 Returns the global rotation of the scene node.
void setScale (const dim::vector3df &Scale)
 Sets the global scaling of the scene node.
dim::vector3df getScale () const
 Returns the global scaling of the scene node.
const dim::matrix4fgetTransformation () const
 Returns the global node's transformation.
const dim::matrix4fgetInverseTransformation () const
 Returns the global node's inverse transformation.
void getOffset (dim::matrix4f &Matrix, bool &Enable) const
 Returns the transformation offset.
dim::vector3df getNodePosition () const
dim::vector3df getPrevPosition () const

Protected Member Functions

 CollisionNode (CollisionMaterial *Material, SceneNode *Node, const ECollisionModels Type)
virtual bool checkCollisionToSphere (const CollisionSphere *Rival, SCollisionContact &Contact) const
virtual bool checkCollisionToCapsule (const CollisionCapsule *Rival, SCollisionContact &Contact) const
virtual bool checkCollisionToCylinder (const CollisionCylinder *Rival, SCollisionContact &Contact) const
virtual bool checkCollisionToCone (const CollisionCone *Rival, SCollisionContact &Contact) const
virtual bool checkCollisionToBox (const CollisionBox *Rival, SCollisionContact &Contact) const
virtual bool checkCollisionToPlane (const CollisionPlane *Rival, SCollisionContact &Contact) const
virtual bool checkCollisionToMesh (const CollisionMesh *Rival, SCollisionContact &Contact) const
virtual bool checkAnyCollisionToSphere (const CollisionSphere *Rival) const
virtual bool checkAnyCollisionToCapsule (const CollisionCapsule *Rival) const
virtual bool checkAnyCollisionToCylinder (const CollisionCylinder *Rival) const
virtual bool checkAnyCollisionToCone (const CollisionCone *Rival) const
virtual bool checkAnyCollisionToBox (const CollisionBox *Rival) const
virtual bool checkAnyCollisionToPlane (const CollisionPlane *Rival) const
virtual bool checkAnyCollisionToMesh (const CollisionMesh *Rival) const
virtual void performCollisionResolvingToSphere (const CollisionSphere *Rival)
virtual void performCollisionResolvingToCapsule (const CollisionCapsule *Rival)
virtual void performCollisionResolvingToCylinder (const CollisionCylinder *Rival)
virtual void performCollisionResolvingToCone (const CollisionCone *Rival)
virtual void performCollisionResolvingToBox (const CollisionBox *Rival)
virtual void performCollisionResolvingToPlane (const CollisionPlane *Rival)
virtual void performCollisionResolvingToMesh (const CollisionMesh *Rival)
bool notifyCollisionContact (const CollisionNode *Rival, const SCollisionContact &Contact)
 Returns true if the collision is about to be resolved.
bool performDetectedContact (const CollisionNode *Rival, const SCollisionContact &Contact)
 Returns true if the collision has been resolved.
bool checkCornerExlusion (const dim::line3df &Line, const dim::vector3df &Point) const
void updatePrevPosition ()

Friends

class CollisionGraph
class CollisionMaterial

Detailed Description

CollisionNode is the root class for all collision models which are sphere, box, mesh and terrain. Its particular an interface for derived collision models.


Constructor & Destructor Documentation

sp::scene::CollisionNode::~CollisionNode (  )  [virtual]
sp::scene::CollisionNode::CollisionNode ( CollisionMaterial Material,
SceneNode Node,
const ECollisionModels  Type 
) [protected]

Member Function Documentation

bool sp::scene::CollisionNode::checkAnyCollisionToBox ( const CollisionBox Rival  )  const [protected, virtual]
bool sp::scene::CollisionNode::checkAnyCollisionToCapsule ( const CollisionCapsule Rival  )  const [protected, virtual]
bool sp::scene::CollisionNode::checkAnyCollisionToCone ( const CollisionCone Rival  )  const [protected, virtual]
bool sp::scene::CollisionNode::checkAnyCollisionToCylinder ( const CollisionCylinder Rival  )  const [protected, virtual]
bool sp::scene::CollisionNode::checkAnyCollisionToMesh ( const CollisionMesh Rival  )  const [protected, virtual]
bool sp::scene::CollisionNode::checkAnyCollisionToPlane ( const CollisionPlane Rival  )  const [protected, virtual]
bool sp::scene::CollisionNode::checkAnyCollisionToSphere ( const CollisionSphere Rival  )  const [protected, virtual]
bool sp::scene::CollisionNode::checkCollision ( const CollisionNode Rival,
SCollisionContact Contact 
) const [virtual]

Checks for a collision between this collision object and the rival object.

bool sp::scene::CollisionNode::checkCollision ( const CollisionNode Rival  )  const [virtual]

Checks if this collision node has any collision with the given rival collision node.

bool sp::scene::CollisionNode::checkCollisionToBox ( const CollisionBox Rival,
SCollisionContact Contact 
) const [protected, virtual]
bool sp::scene::CollisionNode::checkCollisionToCapsule ( const CollisionCapsule Rival,
SCollisionContact Contact 
) const [protected, virtual]
bool sp::scene::CollisionNode::checkCollisionToCone ( const CollisionCone Rival,
SCollisionContact Contact 
) const [protected, virtual]
bool sp::scene::CollisionNode::checkCollisionToCylinder ( const CollisionCylinder Rival,
SCollisionContact Contact 
) const [protected, virtual]
bool sp::scene::CollisionNode::checkCollisionToMesh ( const CollisionMesh Rival,
SCollisionContact Contact 
) const [protected, virtual]
bool sp::scene::CollisionNode::checkCollisionToPlane ( const CollisionPlane Rival,
SCollisionContact Contact 
) const [protected, virtual]
bool sp::scene::CollisionNode::checkCollisionToSphere ( const CollisionSphere Rival,
SCollisionContact Contact 
) const [protected, virtual]
bool sp::scene::CollisionNode::checkCornerExlusion ( const dim::line3df Line,
const dim::vector3df Point 
) const [protected]
bool sp::scene::CollisionNode::checkIntersection ( const dim::line3df Line,
SIntersectionContact Contact 
) const [virtual]

Checks for an intersection between this collision object and the given line and stores the result in the specified contact structure.

Parameters:
Line,: Specifies the line which could intersect this object.
Contact,: Specifies the structure where the intersection result will be stored.
Note:
The implementations of this interface function normally only store the point and normal vector of an intersection.

Reimplemented in sp::scene::CollisionBox, sp::scene::CollisionCapsule, sp::scene::CollisionCone, sp::scene::CollisionCylinder, sp::scene::CollisionMesh, sp::scene::CollisionPlane, and sp::scene::CollisionSphere.

bool sp::scene::CollisionNode::checkIntersection ( const dim::line3df Line,
bool  ExcludeCorners = false 
) const [virtual]

Returns true if an intersection between this collision object and the given line exists but does not return any further information.

Parameters:
Line,: Specifies the line which could intersect this object.
ExcludeCorners,: Specifies whether the line's corners should be ingored. This can be useful for ray-tracing or lightmapping to avoid self-shadowing.

Reimplemented in sp::scene::CollisionBox, sp::scene::CollisionCapsule, sp::scene::CollisionCone, sp::scene::CollisionCylinder, sp::scene::CollisionMesh, sp::scene::CollisionPlane, and sp::scene::CollisionSphere.

void sp::scene::CollisionNode::findIntersections ( const dim::line3df Line,
std::list< SIntersectionContact > &  ContactList 
) const [virtual]

Checks for intersections between this collision object and the given line and stored the result in the specified contact list.

Parameters:
Line,: Specifies the line which could intersect this object.
ContactList,: Specifies the list where all the intersection results will be stored.
Note:
The implementations of this interface function don't sort the resulting contact list.

Reimplemented in sp::scene::CollisionMesh.

s32 sp::scene::CollisionNode::getFlags (  )  const [inline]

Returns teh flags for collision detection. By default COLLISIONFLAG_FULL.

const dim::matrix4f& sp::scene::CollisionNode::getInverseTransformation (  )  const [inline]

Returns the global node's inverse transformation.

CollisionMaterial* sp::scene::CollisionNode::getMaterial (  )  const [inline]

Returns the collision material.

virtual f32 sp::scene::CollisionNode::getMaxMovement (  )  const [pure virtual]

Returns the maximal movement (e.g. for a sphere it's the radius). This is used internally. A collision node can still be moved faster than this value.

Implemented in sp::scene::CollisionBox, sp::scene::CollisionLineBased, sp::scene::CollisionMesh, sp::scene::CollisionPlane, and sp::scene::CollisionSphere.

SceneNode* sp::scene::CollisionNode::getNode (  )  const [inline]

Returns a pointer to the SceneNode object.

dim::vector3df sp::scene::CollisionNode::getNodePosition (  )  const [inline]

Returns the node position stored after updating the collision node's transformation. This is used internally and can differ from the collision node's transformation.

See also:
getPrevPosition
void sp::scene::CollisionNode::getOffset ( dim::matrix4f Matrix,
bool &  Enable 
) const [inline]

Returns the transformation offset.

dim::vector3df sp::scene::CollisionNode::getPosition (  )  const [inline]

Returns the global position of the scene node.

dim::vector3df sp::scene::CollisionNode::getPrevPosition (  )  const [inline]

Returns the previous position stored in the previous frame. This is used internally and can differ from the collision node's transformation.

See also:
getNodePosition
dim::matrix4f sp::scene::CollisionNode::getRotation (  )  const [inline]

Returns the global rotation of the scene node.

dim::vector3df sp::scene::CollisionNode::getScale (  )  const [inline]

Returns the global scaling of the scene node.

const dim::matrix4f& sp::scene::CollisionNode::getTransformation (  )  const [inline]

Returns the global node's transformation.

ECollisionModels sp::scene::CollisionNode::getType (  )  const [inline]

Returns the collision model type.

void sp::scene::CollisionNode::move ( const dim::vector3df Direction  )  [inline]

Wrapper function for SceneNode::move.

bool sp::scene::CollisionNode::notifyCollisionContact ( const CollisionNode Rival,
const SCollisionContact Contact 
) [protected]

Returns true if the collision is about to be resolved.

void sp::scene::CollisionNode::performCollisionResolving ( const CollisionNode Rival  )  [virtual]

Checks for a collision between this collision object and the rival object and performs collision resolving as well.

void sp::scene::CollisionNode::performCollisionResolvingToBox ( const CollisionBox Rival  )  [protected, virtual]
void sp::scene::CollisionNode::performCollisionResolvingToCapsule ( const CollisionCapsule Rival  )  [protected, virtual]
void sp::scene::CollisionNode::performCollisionResolvingToCone ( const CollisionCone Rival  )  [protected, virtual]
void sp::scene::CollisionNode::performCollisionResolvingToCylinder ( const CollisionCylinder Rival  )  [protected, virtual]
void sp::scene::CollisionNode::performCollisionResolvingToMesh ( const CollisionMesh Rival  )  [protected, virtual]
void sp::scene::CollisionNode::performCollisionResolvingToPlane ( const CollisionPlane Rival  )  [protected, virtual]
void sp::scene::CollisionNode::performCollisionResolvingToSphere ( const CollisionSphere Rival  )  [protected, virtual]
bool sp::scene::CollisionNode::performDetectedContact ( const CollisionNode Rival,
const SCollisionContact Contact 
) [protected]

Returns true if the collision has been resolved.

void sp::scene::CollisionNode::setFlags ( s32  Flags  )  [inline]

Sets the flags for collision detection. By default COLLISIONFLAG_FULL.

See also:
ECollisionFlags.
void sp::scene::CollisionNode::setMaterial ( CollisionMaterial Material  )  [virtual]

Sets the collision material.

void sp::scene::CollisionNode::setOffset ( const dim::matrix4f Matrix,
bool  Enable = true 
)

Sets the transformation offset. This matrix will be multiplied to the scene-node's global transformation.

void sp::scene::CollisionNode::setPosition ( const dim::vector3df Position,
bool  UpdatePrevPosition = true 
)

Sets the global position of the scene node.

void sp::scene::CollisionNode::setRotation ( const dim::matrix4f Rotation  )  [inline]

Sets the global rotation of the scene node.

void sp::scene::CollisionNode::setScale ( const dim::vector3df Scale  )  [inline]

Sets the global scaling of the scene node.

void sp::scene::CollisionNode::setupTransformation ( const dim::matrix4f Matrix  ) 

Sets up the collision node transformation directly. Only use this if you want to use a custom transformation for the collision node.

void sp::scene::CollisionNode::translate ( const dim::vector3df Direction  )  [inline]

Wrapper function for SceneNode::translate.

void sp::scene::CollisionNode::turn ( const dim::vector3df Rotation  )  [inline]

Wrapper function for SceneNode::turn.

void sp::scene::CollisionNode::updateCollisions (  ) 

Updates all collisions with other collision-nodes. This will be called for each collision-node when "updateScene" is called from the collision-graph.

void sp::scene::CollisionNode::updatePrevPosition (  )  [protected]
void sp::scene::CollisionNode::updateTransformation (  ) 

Updates the collision-node's transformation. Call this after you have changed the scene-node's transformation. Or only use the transformation functions of the collision-node itself.

        // Use this:
        MySceneNode->translate(dim::vector3df(0, 0, 1));
        MyCollisionNode->updateTransformation();
        
        // Or this:
        MyCollisionNode->translate(dim::vector3df(0, 0, 1));

Friends And Related Function Documentation

friend class CollisionGraph [friend]
friend class CollisionMaterial [friend]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines