Collision class is used to detect collisions

Collision 类用于检测碰撞。

构造函数

方法

  • 参数

    返回 number

    The relationship type: 0 for disjoint, 1 for contains, 2 for intersecting.

    Determines the spatial relationship between two bounding boxes.

    确定两个包围盒之间的空间关系。

  • 参数

    返回 number

    The relationship type: 0 for disjoint, 1 for contains, 2 for intersecting.

    Determines the spatial relationship between a bounding box and a point.

    确定包围盒和点之间的空间关系。

  • 参数

    返回 number

    The relationship type: 0 for disjoint, 1 for contains, 2 for intersecting.

    Determines the spatial relationship between a bounding box and a bounding sphere.

    确定包围盒和包围球之间的空间关系。

  • 参数

    • box: BoundBox

      The bounding box.

    • point: Vector3

      The point in space.

    • out: Vector3

      The closest point on the bounding box.

    返回 void

    Finds the closest point on a bounding box to a given point in space.

    找到空间中点到包围盒的最近点。

  • 参数

    • plane: Plane

      The plane.

    • point: Vector3

      The point in space.

    • out: Vector3

      The closest point on the plane.

    返回 void

    Finds the closest point on a plane to a given point in space.

    找到空间中点到平面的最近点。

  • 参数

    • point: Vector3

      The point in space.

    • vertex1: Vector3

      The first vertex of the triangle.

    • vertex2: Vector3

      The second vertex of the triangle.

    • vertex3: Vector3

      The third vertex of the triangle.

    • out: Vector3

      The closest point on the triangle.

    返回 void

    Finds the closest point on a triangle to a given point in space.

    找到空间中点到三角形的最近点。

  • 参数

    • sphere: BoundSphere

      The bounding sphere.

    • point: Vector3

      The point in space.

    • out: Vector3

      The closest point on the bounding sphere.

    返回 void

    Finds the closest point on a bounding sphere to a given point in space.

    找到空间中点到包围球的最近点。

  • 参数

    • sphere1: BoundSphere

      The first bounding sphere.

    • sphere2: BoundSphere

      The second bounding sphere.

    • out: Vector3

      The closest point on the first bounding sphere to the second.

    返回 void

    Finds the closest points between two bounding spheres.

    找到两个包围球之间的最近点。

  • 参数

    返回 number

    The distance between the two bounding boxes.

    Calculates the distance between two bounding boxes in space.

    计算空间中两个包围盒之间的距离。

  • 参数

    返回 number

    The distance from the point to the bounding box.

    Calculates the distance from a point to a bounding box in space.

    计算空间中点到包围盒的距离。

  • 参数

    返回 number

    The distance from the point to the plane.

    Calculates the distance from a point to a plane in space.

    计算空间中点到平面的距离。

  • 参数

    返回 number

    The distance from the point to the bounding sphere.

    Calculates the distance from a point to a bounding sphere in space.

    计算空间中点到包围球的距离。

  • 参数

    返回 number

    The distance between the two bounding spheres.

    Calculates the distance between two bounding spheres in space.

    计算空间中两个包围球之间的距离。

  • 参数

    返回 boolean

    True if they intersect, otherwise false.

    Determines whether two bounding boxes intersect.

    判断两个包围盒是否相交。

  • 参数

    返回 boolean

    True if they intersect, otherwise false.

    Determines whether a bounding box intersects with a bounding sphere.

    判断包围盒是否与包围球是否相交。

  • 参数

    返回 number

    The intersection type of the plane and the bounding box:

    • 0(PlaneIntersectionType_Back): back,
    • 1(PlaneIntersectionType_Front): front,
    • 2(PlaneIntersectionType_Intersecting): intersecting.

    Determines the intersection status between a plane and a bounding box.

    判断平面与包围盒之间的相交状态。

  • 参数

    • plane1: Plane

      The first plane.

    • plane2: Plane

      The second plane.

    返回 boolean

    True if they intersect, otherwise false.

    Determines whether two planes intersect.

    判断两个平面是否相交。

  • 参数

    • plane1: Plane

      The first plane.

    • plane2: Plane

      The second plane.

    • line: Ray

      The line representing the intersection.

    返回 boolean

    True if they intersect, otherwise false.

    Determines whether two planes intersect and outputs the line of intersection.

    判断两个平面是否相交并输出相交线。

  • 参数

    返回 number

    The type of intersection between a point and a plane:

    • 0(PlaneIntersectionType_Back): back,
    • 1(PlaneIntersectionType_Front): front,
    • 2(PlaneIntersectionType_Intersecting): intersecting.

    Determines the intersection status between a point and a plane.

    判断点与平面之间的相交状态。

  • 参数

    返回 number

    The intersection type of the plane and the bounding sphere: 0-back, 1-front, 2-intersecting.

    Determines the intersection status between a plane and a bounding sphere.

    判断平面与包围球之间的相交状态。

  • 参数

    • plane: Plane

      The plane.

    • vertex1: Vector3

      The first vertex of the triangle.

    • vertex2: Vector3

      The second vertex of the triangle.

    • vertex3: Vector3

      The third vertex of the triangle.

    返回 number

    The spatial relationship between the plane and the triangle:

    • 0(PlaneIntersectionType_Back): back,
    • 1(PlaneIntersectionType_Front): front,
    • 2(PlaneIntersectionType_Intersecting): intersecting.

    Determines whether a plane intersects with a triangle in space and returns the spatial relationship.

    判断空间中的平面是否与三角形相交,并返回空间位置关系。

  • 参数

    返回 number

    The distance to the intersection point, or -1 if there is no intersection.

    Determines whether a ray intersects with a bounding box and outputs the distance to the intersection.

    判断射线是否与包围盒相交,并输出到交点的距离。

  • 参数

    返回 number

    The distance to the intersection, or -1 if there is no intersection.

    Determines whether a ray intersects with a bounding box and returns the intersection point.

    判断射线是否与包围盒相交,并返回交点。

  • 参数

    • ray: Ray

      The ray.

    • plane: Plane

      The plane.

    返回 number

    The distance to the intersection point, or -1 if there is no intersection.

    Determines whether a ray intersects with a plane and returns the distance to the intersection.

    判断射线是否与平面相交,并返回到交点的距离。

  • 参数

    • ray: Ray

      The ray.

    • plane: Plane

      The plane.

    • out: Vector3

      The intersection point.

    返回 boolean

    True if there is an intersection, otherwise false.

    Determines whether a ray intersects with a plane and outputs the intersection point.

    判断射线是否与平面相交,并输出交点。

  • 参数

    返回 boolean

    True if there is an intersection, otherwise false.

    Determines whether a ray intersects with a point.

    判断射线是否与点相交。

  • 参数

    • ray1: Ray

      The first ray.

    • ray2: Ray

      The second ray.

    • out: Vector3

      The intersection point.

    返回 boolean

    True if there is an intersection, otherwise false.

    Determines whether two rays intersect and outputs the intersection point.

    判断两条射线是否相交,并输出交点。

  • 参数

    返回 number

    The distance to the intersection point, or -1 if there is no intersection.

    Determines whether a ray intersects with a bounding sphere and returns the distance to the intersection.

    判断射线是否与包围球相交,并返回到交点的距离。

  • 参数

    返回 number

    The distance to the intersection, or -1 if there is no intersection.

    Determines whether a ray intersects with a bounding sphere and returns the distance to the intersection.

    判断射线是否与包围球相交并返回到交点的距离。

  • 参数

    • ray: Ray

      The ray.

    • vertex1: Vector3

      The first vertex of the triangle.

    • vertex2: Vector3

      The second vertex of the triangle.

    • vertex3: Vector3

      The third vertex of the triangle.

    • out: number

      The distance to the intersection point.

    返回 boolean

    True if there is an intersection, otherwise false.

    Determines whether a ray intersects with a triangle and outputs the distance to the intersection.

    判断射线是否与三角形相交,并输出到交点的距离。

  • 参数

    • ray: Ray

      The ray.

    • vertex1: Vector3

      The first vertex of the triangle.

    • vertex2: Vector3

      The second vertex of the triangle.

    • vertex3: Vector3

      The third vertex of the triangle.

    • out: Vector3

      The intersection point.

    返回 boolean

    True if there is an intersection, otherwise false.

    Determines whether a ray intersects with a triangle and outputs the intersection point.

    判断射线是否与三角形相交,并输出交点。

  • 参数

    返回 boolean

    True if they intersect, otherwise false.

    Determines whether one bounding sphere intersects with another bounding sphere.

    判断一个包围球是否与另一个包围球相交。

  • 参数

    • sphere: BoundSphere

      The bounding sphere.

    • vertex1: Vector3

      The first vertex of the triangle.

    • vertex2: Vector3

      The second vertex of the triangle.

    • vertex3: Vector3

      The third vertex of the triangle.

    返回 boolean

    True if they intersect, otherwise false.

    Determines whether a bounding sphere intersects with a triangle.

    判断包围球是否与三角形相交。

  • 参数

    返回 number

    The spatial relationship: 0 for disjoint, 1 for contains, 2 for intersecting.

    Determines whether a bounding sphere contains a bounding box.

    判断包围球是否包含包围盒。

  • 参数

    返回 number

    The relationship type: 0 for disjoint, 1 for contains, 2 for intersecting.

    Determines the spatial relationship between a bounding sphere and a point.

    确定包围球和点之间的空间关系。

  • 参数

    返回 number

    The spatial relationship: 0 for disjoint, 1 for contains, 2 for intersecting.

    Determines whether one bounding sphere contains another bounding sphere.

    判断一个包围球是否包含另一个包围球。

  • 参数

    • sphere: BoundSphere

      The bounding sphere.

    • vertex1: Vector3

      The first vertex of the triangle.

    • vertex2: Vector3

      The second vertex of the triangle.

    • vertex3: Vector3

      The third vertex of the triangle.

    返回 number

    The relationship type: 0 for disjoint, 1 for contains, 2 for intersecting.

    Determines the spatial relationship between a bounding sphere and a triangle.

    确定包围球和三角形之间的空间关系。