The Scene Collision Manager provides methods for performing collision tests and picking on scene nodes. More...
#include <ISceneCollisionManager.h>
The Scene Collision Manager provides methods for performing collision tests and picking on scene nodes.
Definition at line 24 of file ISceneCollisionManager.h.
virtual bool irr::scene::ISceneCollisionManager::getCollisionPoint | ( | const core::line3d< f32 > & | ray, |
ITriangleSelector * | selector, | ||
core::vector3df & | outCollisionPoint, | ||
core::triangle3df & | outTriangle, | ||
ISceneNode *& | outNode | ||
) | [pure virtual] |
Finds the nearest collision point of a line and lots of triangles, if there is one.
ray,: | Line with which collisions are tested. |
selector,: | TriangleSelector containing the triangles. It can be created for example using ISceneManager::createTriangleSelector() or ISceneManager::createTriangleOctreeSelector(). |
outCollisionPoint,: | If a collision is detected, this will contain the position of the nearest collision to the line-start. |
outTriangle,: | If a collision is detected, this will contain the triangle with which the ray collided. |
outNode,: | If a collision is detected, this will contain the scene node associated with the triangle that was hit. |
virtual core::vector3df irr::scene::ISceneCollisionManager::getCollisionResultPosition | ( | ITriangleSelector * | selector, |
const core::vector3df & | ellipsoidPosition, | ||
const core::vector3df & | ellipsoidRadius, | ||
const core::vector3df & | ellipsoidDirectionAndSpeed, | ||
core::triangle3df & | triout, | ||
core::vector3df & | hitPosition, | ||
bool & | outFalling, | ||
ISceneNode *& | outNode, | ||
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.
selector,: | TriangleSelector containing the triangles of the world. It can be created for example using ISceneManager::createTriangleSelector() or ISceneManager::createTriangleOctreeSelector(). |
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. |
hitPosition,: | Return value for the position of the collision |
outFalling,: | Is set to true if the ellipsoid is falling down, caused by gravity. |
outNode,: | the node with which the ellipoid collided (if any) |
slidingSpeed,: | DOCUMENTATION NEEDED. |
gravityDirectionAndSpeed,: | Direction and force of gravity. |
virtual core::line3d<f32> irr::scene::ISceneCollisionManager::getRayFromScreenCoordinates | ( | const core::position2d< s32 > & | pos, |
ICameraSceneNode * | camera = 0 |
||
) | [pure virtual] |
Returns a 3d ray which would go through the 2d screen coodinates.
pos,: | Screen coordinates in pixels. |
camera,: | Camera from which the ray starts. If null, the active camera is used. |
virtual ISceneNode* irr::scene::ISceneCollisionManager::getSceneNodeAndCollisionPointFromRay | ( | core::line3df | ray, |
core::vector3df & | outCollisionPoint, | ||
core::triangle3df & | outTriangle, | ||
s32 | idBitMask = 0 , |
||
ISceneNode * | collisionRootNode = 0 , |
||
bool | noDebugObjects = false |
||
) | [pure virtual] |
Perform a ray/box and ray/triangle collision check on a heirarchy of scene nodes.
This checks all scene nodes under the specified one, first by ray/bounding box, and then by accurate ray/triangle collision, finding the nearest collision, and the scene node containg it. It returns the node hit, and (via output parameters) the position of the collision, and the triangle that was hit.
All scene nodes in the hierarchy tree under the specified node are checked. Only nodes that are visible, with an ID that matches at least one bit in the supplied bitmask, and which have a triangle selector are considered as candidates for being hit. You do not have to build a meta triangle selector; the individual triangle selectors of each candidate scene node are used automatically.
ray,: | Line with which collisions are tested. |
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. |
idBitMask,: | Only scene nodes with an id which matches at least one of the bits contained in this mask will be tested. However, if this parameter is 0, then all nodes are checked. |
collisionRootNode,: | the scene node at which to begin checking. Only this node and its children will be checked. If you want to check the entire scene, pass 0, and the root scene node will be used (this is the default). |
noDebugObjects,: | when true, debug objects are not considered viable targets. Debug objects are scene nodes with IsDebugObject() = true. |
virtual ISceneNode* irr::scene::ISceneCollisionManager::getSceneNodeFromCameraBB | ( | ICameraSceneNode * | camera, |
s32 | idBitMask = 0 , |
||
bool | bNoDebugObjects = false |
||
) | [pure virtual] |
Get the scene node, which the given 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.
camera,: | Camera from which the ray is casted. |
idBitMask,: | Only scene nodes with an id which matches at least one of the bits contained in this mask will be tested. However, if this parameter is 0, then all nodes are checked. feature is disabled. Please note that the default node id of -1 will match with every bitmask != 0 |
bNoDebugObjects,: | Doesn't take debug objects into account when true. These are scene nodes with IsDebugObject() = true. |
virtual ISceneNode* irr::scene::ISceneCollisionManager::getSceneNodeFromRayBB | ( | const core::line3d< f32 > & | ray, |
s32 | idBitMask = 0 , |
||
bool | bNoDebugObjects = false , |
||
ISceneNode * | root = 0 |
||
) | [pure virtual] |
Returns 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. The recursive search can be limited be specifying a scene node.
ray | Line with which collisions are tested. |
idBitMask | Only scene nodes with an id which matches at least one of the bits contained in this mask will be tested. However, if this parameter is 0, then all nodes are checked. |
bNoDebugObjects,: | Doesn't take debug objects into account when true. These are scene nodes with IsDebugObject() = true. |
root | If different from 0, the search is limited to the children of this node. |
virtual ISceneNode* irr::scene::ISceneCollisionManager::getSceneNodeFromScreenCoordinatesBB | ( | const core::position2d< s32 > & | pos, |
s32 | idBitMask = 0 , |
||
bool | bNoDebugObjects = false , |
||
ISceneNode * | root = 0 |
||
) | [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. You can limit the recursive search so just all children of the specified root are tested.
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. Please note that the default node id of -1 will match with every bitmask != 0 |
bNoDebugObjects,: | Doesn't take debug objects into account when true. These are scene nodes with IsDebugObject() = true. |
root | If different from 0, the search is limited to the children of this node. |
virtual core::position2d<s32> irr::scene::ISceneCollisionManager::getScreenCoordinatesFrom3DPosition | ( | const core::vector3df & | pos, |
ICameraSceneNode * | camera = 0 , |
||
bool | useViewPort = false |
||
) | [pure virtual] |
Calculates 2d screen position from a 3d position.
pos,: | 3D position in world space to be transformed into 2d. |
camera,: | Camera to be used. If null, the currently active camera is used. |
useViewPort,: | Calculate screen coordinates relative to the current view port. Please note that unless the driver does not take care of the view port, it is usually best to get the result in absolute screen coordinates (flag=false). |