Пример #1
0
    void NarrowCollisionCheck()
    {
        HullCollision col;

        for (int i = 0; i < Collisions.Count; i++)
        {
            col = Collisions[i];

            if (col.a.GetHullType() == CollisionHull3D.hullType.Sphere)
            {
                if (col.b.GetHullType() == CollisionHull3D.hullType.Sphere) // sphere sphere
                {
                    CollisionHull3D.SphereSphereCollision(col);
                    if (col.status)
                    {
                        col.a.gameObject.GetComponent <Renderer>().material.color = Color.green;
                        col.b.gameObject.GetComponent <Renderer>().material.color = Color.green;
                    }
                }
                else if (col.b.GetHullType() == CollisionHull3D.hullType.AABB) // sphere aabb
                {
                    CollisionHull3D.SphereAABBCollision(col);
                    if (col.status)
                    {
                        col.a.gameObject.GetComponent <Renderer>().material.color = Color.green;
                        col.b.gameObject.GetComponent <Renderer>().material.color = Color.green;
                    }
                }
                else if (col.b.GetHullType() == CollisionHull3D.hullType.OBB) // sphere obb
                {
                    CollisionHull3D.SphereOBBCollision(col);
                    if (col.status)
                    {
                        col.a.gameObject.GetComponent <Renderer>().material.color = Color.green;
                        col.b.gameObject.GetComponent <Renderer>().material.color = Color.green;
                    }
                }
            }
            else if (col.a.GetHullType() == CollisionHull3D.hullType.AABB)
            {
                if (col.b.GetHullType() == CollisionHull3D.hullType.Sphere) // aabb sphere
                {
                    CollisionHull3D.SphereAABBCollision(col);
                    if (col.status)
                    {
                        col.a.gameObject.GetComponent <Renderer>().material.color = Color.green;
                        col.b.gameObject.GetComponent <Renderer>().material.color = Color.green;
                    }
                }
                else if (col.b.GetHullType() == CollisionHull3D.hullType.AABB) // aabb aabb
                {
                    CollisionHull3D.AABBAABBCollision(col);
                    if (col.status)
                    {
                        col.a.gameObject.GetComponent <Renderer>().material.color = Color.green;
                        col.b.gameObject.GetComponent <Renderer>().material.color = Color.green;
                    }
                }

                /*
                 * else if (col.b.GetHullType() == CollisionHull3D.hullType.OBB) // aabb obb
                 * {
                 *  CollisionHull3D.AABBOBBCollision(col);
                 *  if (col.status)
                 *  {
                 *      col.a.gameObject.GetComponent<Renderer>().material.color = Color.green;
                 *      col.b.gameObject.GetComponent<Renderer>().material.color = Color.green;
                 *  }
                 * }*/
            }
            else if (col.a.GetHullType() == CollisionHull3D.hullType.OBB) //
            {
                if (col.b.GetHullType() == CollisionHull3D.hullType.Sphere)
                {
                    CollisionHull3D.SphereOBBCollision(col);
                    if (col.status)
                    {
                        col.a.gameObject.GetComponent <Renderer>().material.color = Color.green;
                        col.b.gameObject.GetComponent <Renderer>().material.color = Color.green;
                    }
                }

                /*
                 * else if (col.b.GetHullType() == CollisionHull3D.hullType.AABB)
                 * {
                 *  CollisionHull3D.AABBOBBCollision(col);
                 *  if (col.status)
                 *  {
                 *
                 *  }
                 * }
                 * else if (col.b.GetHullType() == CollisionHull3D.hullType.OBB)
                 * {
                 *  //Debug.Log("entered OBBOBB collision checker");
                 *  CollisionHull3D.OBBOBBCollision(col);
                 *  if (col.status)
                 *  {
                 *
                 *  }
                 * }*/
            }
        }
    }