public override CollisionInfo CollisionTests(CollisionHull2D other)
    {
        switch (other.hullType)
        {
        case CollisionHull2D.PhysDetect.Circle:
            return(CollisionHull2D.CircleCircle(this, other as CircleCollision2D));

        case CollisionHull2D.PhysDetect.AABB:
            return(CollisionHull2D.CircleAABB(this, other as AxisAllignedBoundingBoxCollision2D));

        case CollisionHull2D.PhysDetect.OBB:
            return(CollisionHull2D.CircleOBB(this, other as ObjectBoundingBoxCollision2D));

        default:
            break;
        }

        return(null);
    }
Beispiel #2
0
    void CheckCollisionsDebug()
    {
        if (CollisionHull2D.AABBAABB(aabb1.GetComponent <AxisAllignedBoundingBoxCollision2D>(), aabb2.GetComponent <AxisAllignedBoundingBoxCollision2D>()))
        {
            Debug.Log("Collision AABB AABB");
        }

        if (CollisionHull2D.CircleCircle(circle1.GetComponent <CircleCollision2D>(), circle2.GetComponent <CircleCollision2D>()))
        {
            Debug.Log("Collision Circ Circ");
        }
        if (CollisionHull2D.CircleAABB(circle1.GetComponent <CircleCollision2D>(), aabb1.GetComponent <AxisAllignedBoundingBoxCollision2D>()))
        {
            Debug.Log("Collision Circ1 AABB1");
        }
        if (CollisionHull2D.CircleAABB(circle2.GetComponent <CircleCollision2D>(), aabb1.GetComponent <AxisAllignedBoundingBoxCollision2D>()))
        {
            Debug.Log("Collision Circ2 AABB1");
        }
        if (CollisionHull2D.CircleAABB(circle2.GetComponent <CircleCollision2D>(), aabb2.GetComponent <AxisAllignedBoundingBoxCollision2D>()))
        {
            Debug.Log("Collision Circ2 AABB2");
        }
        if (CollisionHull2D.CircleAABB(circle1.GetComponent <CircleCollision2D>(), aabb2.GetComponent <AxisAllignedBoundingBoxCollision2D>()))
        {
            Debug.Log("Collision Circ1 AABB2");
        }
        if (CollisionHull2D.AABBOBB(aabb1.GetComponent <AxisAllignedBoundingBoxCollision2D>(), obb1.GetComponent <ObjectBoundingBoxCollision2D>()))
        {
            Debug.Log("Collision AABB1 OBB1");
        }
        if (CollisionHull2D.AABBOBB(aabb1.GetComponent <AxisAllignedBoundingBoxCollision2D>(), obb2.GetComponent <ObjectBoundingBoxCollision2D>()))
        {
            Debug.Log("Collision AABB1 OBB2");
        }
        if (CollisionHull2D.AABBOBB(aabb2.GetComponent <AxisAllignedBoundingBoxCollision2D>(), obb1.GetComponent <ObjectBoundingBoxCollision2D>()))
        {
            Debug.Log("Collision AABB2 OBB1");
        }
        if (CollisionHull2D.AABBOBB(aabb2.GetComponent <AxisAllignedBoundingBoxCollision2D>(), obb2.GetComponent <ObjectBoundingBoxCollision2D>()))
        {
            Debug.Log("Collision AABB2 OBB2");
        }
        if (CollisionHull2D.CircleOBB(circle2.GetComponent <CircleCollision2D>(), obb2.GetComponent <ObjectBoundingBoxCollision2D>()))
        {
            Debug.Log("Collision Circ2 OBB2");
        }
        if (CollisionHull2D.CircleOBB(circle1.GetComponent <CircleCollision2D>(), obb1.GetComponent <ObjectBoundingBoxCollision2D>()))
        {
            Debug.Log("Collision Circ1 OBB1");
        }
        if (CollisionHull2D.CircleOBB(circle1.GetComponent <CircleCollision2D>(), obb2.GetComponent <ObjectBoundingBoxCollision2D>()))
        {
            Debug.Log("Collision Circ1 OBB2");
        }
        if (CollisionHull2D.CircleOBB(circle2.GetComponent <CircleCollision2D>(), obb1.GetComponent <ObjectBoundingBoxCollision2D>()))
        {
            Debug.Log("Collision Circ2 OBB1");
        }
        if (CollisionHull2D.OBBOBB(obb1.GetComponent <ObjectBoundingBoxCollision2D>(), obb2.GetComponent <ObjectBoundingBoxCollision2D>()))
        {
            Debug.Log("Collision OBB OBB");
        }
    }