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 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.

    • 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.

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

  • 参数

    • 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.

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

  • 参数

    • 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.

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

  • 参数

    • 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.

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