示例#1
0
 //---------------------------------------------------------------------
 public bool isIn(CBoxCollider other)
 {
     return
         (other.isInBox(mQuadrantPoints.TL) ||
          other.isInBox(mQuadrantPoints.TR) ||
          other.isInBox(mQuadrantPoints.BL) ||
          other.isInBox(mQuadrantPoints.BR) ||
          isInBox(other.mQuadrantPoints.TL + other.mPosition) ||
          isInBox(other.mQuadrantPoints.TR + other.mPosition) ||
          isInBox(other.mQuadrantPoints.BL + other.mPosition) ||
          isInBox(other.mQuadrantPoints.BR + other.mPosition));
 }
        //---------------------------------------------------------------------
        public void test1()
        {
            CBoxCollider box1 = new CBoxCollider(0, 0, 20, 20);
            CBoxCollider box2 = new CBoxCollider(0, 0, 20, 20);

            box1.setPosition(EbVector3.Zero);
            box2.setPosition(new EbVector3(10, 10, 0));
            assert(box1.isIn(box2), "error", "ok");

            box1.setPosition(EbVector3.Zero);
            box2.setPosition(new EbVector3(20, 10, 0));
            assert(box1.isIn(box2), "error", "ok");

            box1.setPosition(EbVector3.Zero);
            box2.setPosition(new EbVector3(212, 10, 0));
            assert(box1.isIn(box2), "error", "ok");
        }
 //---------------------------------------------------------------------
 public void test2()
 {
     CBoxCollider box1 = new CBoxCollider(0, 0, 20, 20);
     //assert(box1.isIn(box2), "error", "ok");
 }