Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members

irr::scene::ISceneCollisionManager Class Reference

The Scene Collision Manager provides methods for performing collision tests and picking on scene nodes. More...

#include <ISceneCollisionManager.h>

Inheritance diagram for irr::scene::ISceneCollisionManager:

irr::IReferenceCounted List of all members.

Public Member Functions

virtual bool getCollisionPoint (const core::line3d< f32 > &ray, ITriangleSelector *selector, core::vector3df &outCollisionPoint, core::triangle3df &outTriangle)=0
 Finds the collision point of a line and lots of triangles, if there is one.
virtual core::vector3df getCollisionResultPosition (ITriangleSelector *selector, const core::vector3df &ellipsoidPosition, const core::vector3df &ellipsoidRadius, const core::vector3df &ellipsoidDirectionAndSpeed, core::triangle3df &triout, bool &outFalling, f32 slidingSpeed=0.0005f, const core::vector3df &gravityDirectionAndSpeed=core::vector3df(0.0f, 0.0f, 0.0f))=0
 Collides a moving ellipsoid with a 3d world with gravity and returns the resulting new position of the ellipsoid.
virtual core::line3d< f32getRayFromScreenCoordinates (core::position2d< s32 > pos, ICameraSceneNode *camera=0)=0
 Returns a 3d ray which would go through the 2d screen coodinates.
virtual ISceneNodegetSceneNodeFromCameraBB (ICameraSceneNode *camera, s32 idBitMask=0, bool bNoDebugObjects=false)=0
 Get the scene node, which the overgiven camera is looking at and whose id matches the bitmask.
virtual ISceneNodegetSceneNodeFromRayBB (core::line3d< f32 > ray, s32 idBitMask=0, bool bNoDebugObjects=false)=0
 Get the nearest scene node which collides with a 3d ray and whose id matches a bitmask.
virtual ISceneNodegetSceneNodeFromScreenCoordinatesBB (core::position2d< s32 > pos, s32 idBitMask=0, bool bNoDebugObjects=false)=0
 Gets the scene node, which is currently visible under the given screencoordinates, viewed from the currently active camera.
virtual core::position2d<
s32
getScreenCoordinatesFrom3DPosition (core::vector3df pos, ICameraSceneNode *camera=0)=0
 Calculates 2d screen position from a 3d position.
virtual ~ISceneCollisionManager ()
 Destructor.

Detailed Description

The Scene Collision Manager provides methods for performing collision tests and picking on scene nodes.

Definition at line 24 of file ISceneCollisionManager.h.


Constructor & Destructor Documentation

virtual irr::scene::ISceneCollisionManager::~ISceneCollisionManager  )  [inline, virtual]
 

Destructor.

Definition at line 29 of file ISceneCollisionManager.h.


Member Function Documentation

virtual bool irr::scene::ISceneCollisionManager::getCollisionPoint const core::line3d< f32 > &  ray,
ITriangleSelector selector,
core::vector3df outCollisionPoint,
core::triangle3df outTriangle
[pure virtual]
 

Finds the collision point of a line and lots of triangles, if there is one.

Parameters:
ray,: Line with witch collisions are tested.
selector,: TriangleSelector containing the triangles. It can be created for example using ISceneManager::createTriangleSelector() or ISceneManager::createTriangleOctTreeSelector().
outCollisionPoint,: If a collision is detected, this will contain the position of the nearest collision.
outTriangle,: If a collision is detected, this will contain the triangle with which the ray collided.
Returns:
True if a collision was detected and false if not.

virtual core::vector3df irr::scene::ISceneCollisionManager::getCollisionResultPosition ITriangleSelector selector,
const core::vector3df ellipsoidPosition,
const core::vector3df ellipsoidRadius,
const core::vector3df ellipsoidDirectionAndSpeed,
core::triangle3df triout,
bool &  outFalling,
f32  slidingSpeed = 0.0005f,
const core::vector3df gravityDirectionAndSpeed = core::vector3df(0.0f, 0.0f, 0.0f)
[pure virtual]
 

Collides a moving ellipsoid with a 3d world with gravity and returns the resulting new position of the ellipsoid.

This can be used for moving a character in a 3d world: The character will slide at walls and is able to walk up stairs. The method used how to calculate the collision result position is based on the paper "Improved Collision detection and Response" by Kasper Fauerby.

Parameters:
selector,: TriangleSelector containing the triangles of the world. It can be created for example using ISceneManager::createTriangleSelector() or ISceneManager::createTriangleOctTreeSelector().
ellipsoidPosition,: Position of the ellipsoid.
ellipsoidRadius,: Radius of the ellipsoid.
ellipsoidDirectionAndSpeed,: Direction and speed of the movement of the ellipsoid.
triout,: Optional parameter where the last triangle causing a collision is stored, if there is a collision.
outFalling,: Is set to true if the ellipsoid is falling down, caused by gravity.
slidingSpeed,: DOCUMENTATION NEEDED.
gravityDirectionAndSpeed,: Direction and force of gravity.
Returns:
New position of the ellipsoid.

virtual core::line3d<f32> irr::scene::ISceneCollisionManager::getRayFromScreenCoordinates core::position2d< s32 pos,
ICameraSceneNode camera = 0
[pure virtual]
 

Returns a 3d ray which would go through the 2d screen coodinates.

Parameters:
pos,: Screen coordinates in pixels.
camera,: Camera from which the ray starts. If null, the active camera is used.
Returns:
Ray starting from the position of the camera and ending at a length of the far value of the camera at a position which would be behind the 2d screen coodinates.

virtual ISceneNode* irr::scene::ISceneCollisionManager::getSceneNodeFromCameraBB ICameraSceneNode camera,
s32  idBitMask = 0,
bool  bNoDebugObjects = false
[pure virtual]
 

Get the scene node, which the overgiven camera is looking at and whose id matches the bitmask.

A ray is simply casted from the position of the camera to the view target position, and all scene nodes are tested against this ray. The collision tests are done using a bounding box for each scene node.

Parameters:
camera,: Camera from which the ray is casted.
idBitMask,: Only scene nodes with an id with bits set like in this mask will be tested. If the BitMask is 0, this feature is disabled.
bNoDebugObjects,: Doesn't take debug objects into account when true. These are scene nodes with IsDebugObject() = true.
Returns:
Scene node nearest to the camera, which collides with the ray and matches the idBitMask, if the mask is not null. If no scene node is found, 0 is returned.

virtual ISceneNode* irr::scene::ISceneCollisionManager::getSceneNodeFromRayBB core::line3d< f32 ray,
s32  idBitMask = 0,
bool  bNoDebugObjects = false
[pure virtual]
 

Get the nearest scene node which collides with a 3d ray and whose id matches a bitmask.

The collision tests are done using a bounding box for each scene node.

Parameters:
ray,: Line with witch collisions are tested.
idBitMask,: Only scene nodes with an id with bits set like in this mask will be tested. If the BitMask is 0, this feature is disabled.
bNoDebugObjects,: Doesn't take debug objects into account when true. These are scene nodes with IsDebugObject() = true.
Returns:
Scene node nearest to ray.start, which collides with the ray and matches the idBitMask, if the mask is not null. If no scene node is found, 0 is returned.

virtual ISceneNode* irr::scene::ISceneCollisionManager::getSceneNodeFromScreenCoordinatesBB core::position2d< s32 pos,
s32  idBitMask = 0,
bool  bNoDebugObjects = false
[pure virtual]
 

Gets the scene node, which is currently visible under the given screencoordinates, viewed from the currently active camera.

The collision tests are done using a bounding box for each scene node.

Parameters:
pos,: Position in pixel screen coordinates, under which the returned scene node will be.
idBitMask,: Only scene nodes with an id with bits set like in this mask will be tested. If the BitMask is 0, this feature is disabled.
bNoDebugObjects,: Doesn't take debug objects into account when true. These are scene nodes with IsDebugObject() = true.
Returns:
Visible scene node under screen coordinates with matching bits in its id. If there is no scene node under this position, 0 is returned.

virtual core::position2d<s32> irr::scene::ISceneCollisionManager::getScreenCoordinatesFrom3DPosition core::vector3df  pos,
ICameraSceneNode camera = 0
[pure virtual]
 

Calculates 2d screen position from a 3d position.

Parameters:
pos,: 3D position in world space to be transformed into 2d.
camera,: Camera to be used. If null, the currently active camera is used.
Returns:
2d screen coordinates which a object in the 3d world would have if it would be rendered to the screen. If the 3d position is behind the camera, it is set to (-10000,-10000). In most cases you can ignore this fact, because if you use this method for drawing a decorator over a 3d object, it will be clipped by the screen borders.


The documentation for this class was generated from the following file:
The Irrlicht Engine
The Irrlicht Engine Documentation © 2003-2008 by Nikolaus Gebhardt. Generated on Sun Sep 21 08:57:58 2008 by Doxygen (1.4.2)