Example #1
0
        public QuadTree(int MaxX, int MinX, int MaxY, int MinY, BouncingThing[] things)
        {
            cldMgr     = new Colliding();
            cells      = new Cell[16];
            objects    = things;
            corners    = new int[4];
            corners[0] = MaxX;
            corners[1] = MinX;
            corners[2] = MaxY;
            corners[3] = MinY;
            int max = things.Length;

            objA = new BouncingThing[max];
            objB = new BouncingThing[max];
            objC = new BouncingThing[max];
            objD = new BouncingThing[max];

            for (int i = 0; i < max; i++)
            {
                objA[i] = new BouncingThing();
                objB[i] = new BouncingThing();
                objC[i] = new BouncingThing();
                objD[i] = new BouncingThing();
            }
        }
        public bool CheckForSATCollisions(BouncingThing obj1, BouncingThing obj2)
        {
            object1 = obj1;
            object2 = obj2;

            Normalize();

            if (CheckNormals(obj1Norms))
                return false;
            if(CheckNormals(obj2Norms))
                return false;
            else
                return true;
        }
Example #3
0
        public bool CheckForSATCollisions(BouncingThing obj1, BouncingThing obj2)
        {
            object1 = obj1;
            object2 = obj2;

            Normalize();

            if (CheckNormals(obj1Norms))
            {
                return(false);
            }
            if (CheckNormals(obj2Norms))
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }