GL.Octree Class
Octree generator for fast ray triangle collision with meshes Dependencies: glmatrix.js (for vector and matrix operations)
Constructor
GL.Octree
(
-
mesh
Parameters:
-
mesh
Meshobject containing vertices buffer (indices buffer optional)
Item Index
Methods
Methods
testRay
(
HitTest
-
origin
-
direction
-
dist_min
-
dist_max
Test collision between ray and triangles in the octree
Parameters:
-
origin
Vec3ray origin position
-
direction
Vec3ray direction position
-
dist_min
Number -
dist_max
Number
Returns:
HitTest:
object containing pos and normal
testSphere
(
Boolean
-
origin
-
radius
test collision between sphere and the triangles in the octree (only test if there is any vertex inside the sphere)
Parameters:
-
origin
Vec3sphere center
-
radius
Number
Returns:
Boolean:
true if the sphere collided with the mesh