The Scene Collision Manager provides methods for performing collision tests and picking on scene nodes.
More...
|
| virtual bool | getCollisionPoint (const core::line3d< f32 > &ray, ITriangleSelector *selector, core::vector3df &outCollisionPoint, core::triangle3df &outTriangle, ISceneNode *&outNode)=0 |
| | Finds the nearest 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, core::vector3df &hitPosition, bool &outFalling, ISceneNode *&outNode, 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< f32 > | getRayFromScreenCoordinates (const core::position2d< s32 > &pos, ICameraSceneNode *camera=0)=0 |
| | Returns a 3d ray which would go through the 2d screen coodinates.
|
| virtual core::position2d< s32 > | getScreenCoordinatesFrom3DPosition (const core::vector3df &pos, ICameraSceneNode *camera=0, bool useViewPort=false)=0 |
| | Calculates 2d screen position from a 3d position.
|
| virtual ISceneNode * | getSceneNodeFromScreenCoordinatesBB (const core::position2d< s32 > &pos, s32 idBitMask=0, bool bNoDebugObjects=false, ISceneNode *root=0)=0 |
| | Gets the scene node, which is currently visible under the given screencoordinates, viewed from the currently active camera.
|
| virtual ISceneNode * | getSceneNodeFromRayBB (const core::line3d< f32 > &ray, s32 idBitMask=0, bool bNoDebugObjects=false, ISceneNode *root=0)=0 |
| | Returns the nearest scene node which collides with a 3d ray and whose id matches a bitmask.
|
| virtual ISceneNode * | getSceneNodeFromCameraBB (ICameraSceneNode *camera, s32 idBitMask=0, bool bNoDebugObjects=false)=0 |
| | Get the scene node, which the given camera is looking at and whose id matches the bitmask.
|
| virtual ISceneNode * | getSceneNodeAndCollisionPointFromRay (const core::line3df &ray, core::vector3df &outCollisionPoint, core::triangle3df &outTriangle, s32 idBitMask=0, ISceneNode *collisionRootNode=0, bool noDebugObjects=false)=0 |
| | Perform a ray/box and ray/triangle collision check on a heirarchy of scene nodes.
|
|
| IReferenceCounted () |
| | Constructor.
|
|
virtual | ~IReferenceCounted () |
| | Destructor.
|
| void | grab () const |
| | Grabs the object. Increments the reference counter by one.
|
| bool | drop () const |
| | Drops the object. Decrements the reference counter by one.
|
| s32 | getReferenceCount () const |
| | Get the reference count.
|
| const c8 * | getDebugName () const |
| | Returns the debug name of the object.
|
The Scene Collision Manager provides methods for performing collision tests and picking on scene nodes.
| virtual ISceneNode * irr::scene::ISceneCollisionManager::getSceneNodeAndCollisionPointFromRay |
( |
const 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.
- Parameters
-
| 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. |
- Returns
- Returns the scene node containing the hit triangle nearest to ray.start. If no collision is detected, then 0 is returned.