Coppercube API Documentation
Class TriangleSelector
Interface to return triangles with specific properties, useful for collision detection.
Class Overview
TriangleSelector()
Interface to return triangles with specific properties, useful for collision detection.
Every SceneNode may have a triangle selector, available with SceneNode::Selector. This is used for doing collision detection:
For example if you know that a collision may have happened in the area between (1,1,1) and (10,10,10), you can get all triangles of the scene
node in this area with the TriangleSelector easily and check every triangle if it collided.
This is the base class of all triangle selector implementations. Use MeshTriangleSelector for an implementation for mesh scene nodes, and MetaTriangleSelector for a selector for multiple other triangle selectors and OctTreeTriangleSelector for an implementation for huge meshes.
This is the base class of all triangle selector implementations. Use MeshTriangleSelector for an implementation for mesh scene nodes, and MetaTriangleSelector for a selector for multiple other triangle selectors and OctTreeTriangleSelector for an implementation for huge meshes.
Method Attributes | Method Name and Description |
---|---|
getAllTriangles(transform, outArray)
Returns all triangles for the scene node associated with this selector
|
|
getCollisionPointWithLine(start, end, bIgnoreBackFaces, outTriangle)
Returns the collision 3d point of a 3d line with the 3d geometry in this triangle selector.
|
|
getTrianglesInBox(box, transform, outArray)
Returns all triangles inside a bounding box, for the scene node associated with this selector.
|
Method Detail
getAllTriangles(transform, outArray)
Returns all triangles for the scene node associated with this selector
- Parameters:
- transform
- {Matrix4} a transformation matrix which transforms all triangles before returning them
- outArray
- {Array} output array of the triangles
- Returns:
- the new TriangleSelector
getCollisionPointWithLine(start, end, bIgnoreBackFaces, outTriangle)
Returns the collision 3d point of a 3d line with the 3d geometry in this triangle selector.
- Parameters:
- start
- {Vect3d} 3d point representing the start of the 3d line
- end
- {Vect3d} 3d point representing the end of the 3d line
- bIgnoreBackFaces
- {Boolean} if set to true, this will ignore back faced polygons, making the query twice as fast
- outTriangle
- {Triangle3d} if set to a triangle, this will contain the 3d triangle with which the line collided
- Returns:
- a 3d position as Bect3d if a collision was found or null if no collision was found
getTrianglesInBox(box, transform, outArray)
Returns all triangles inside a bounding box, for the scene node associated with this selector. This method will
return at least the triangles that intersect the box, but may return other triangles as well.
- Parameters:
- box
- {Box3d}
- transform
- {Matrix4} a transformation matrix which transforms all triangles before returning them
- outArray
- {Array} output array of the triangles
- Returns:
- the new TriangleSelector