ObjectHelper.collision Class
Collision checking.
Constructor
ObjectHelper.collision
()
static
Item Index
Methods
AABBtoAABB
-
box
-
box
Tests the collision between two Axis Aligned Bounding Boxes
Parameters:
-
box
AABB1st Axis Aligned Bounding Box
-
box
AABB2nd Axis Aligned Bounding Box
Returns:
false if there is no collision, true if there is
AABBtoOBB
-
box
-
box
Tests the collision between an Axis Aligned Bounding Box and an Oriented Bounding Box
Parameters:
-
box
AABBthe Axis Aligned Bounding Box
-
box
OBBthe Oriented Bounding Box
Returns:
false if there is no collision, true if there is
AABBtoOyBB
-
box
-
box
Tests the collision between an Axis Aligned Bounding Box and a Bounding Box Oriented along y axis
Parameters:
-
box
AABBthe Axis Aligned Bounding Box
-
box
OyBBthe Bounding Box Oriented along Y axis
Returns:
false if there is no collision, true if there is
interval
-
a1
-
b1
-
a2
-
b2
Tests the collision in one dimension between two intervals [a1,b1] , [a2,b2]
a1------b1 a2------------b2
without numeric imprecision is a2 < b1 == a1 < b2
Parameters:
Returns:
false if there is no collision, true if there is
MeshToAABB
-
worldMatrix
-
positions
-
indices
-
box
Tests the collision between a mesh and an Axis Aligned Bounding Box. /!\ This method has a high impact on performance, use with caution.
Parameters:
-
worldMatrix
BABYLON.Matrixthe transformation matrix of the mesh
-
positions
Number[]indices of the mesh vertices, as returned by babylon.Mesh.getVertexBuffer ( ie vertices coordinates concatenated in an array )
-
indices
Number[]indices of the face vertices, as returned by babylon.Mesh.getVertexBuffer ( ie faces indices concatenated in an array )
-
box
AABBthe Axis Aligned Bounding Box
Returns:
false if there is no collision, true if there is
OBBtoOBB
-
box
-
box
Tests the collision between two Oriented Bounding Boxes
Parameters:
-
box
OBB1st Oriented Bounding Box
-
box
OBB2nd Oriented Bounding Box
Returns:
false if there is no collision, true if there is
rayToAABB
-
o
-
v
-
box
Tests the collision between a ray and an Axis Aligned Bounding Box
Parameters:
-
o
BABYLON.Vector3the origin of the ray
-
v
BABYLON.Vector3the direction of the ray
-
box
AABBthe Axis Aligned Bounding Box
Returns:
false if there is no collision, else return a number t such that o+v*t is the point where the ray first collides the box, /!\ t can be 0 ( beware of untyped test )
triangleToAABB
-
trianglesPoints
-
box
Tests the collision between a triangle and an Axis Aligned Bounding Box
Parameters:
-
trianglesPoints
BABYLON.Vector3three points which are the vertices of the triangle
-
box
AABBthe Axis Aligned Bounding Box
Returns:
false if there is no collision, true if there is