示例#1
0
 public void CheckSelf()
 {
     List<Batch> batches = GetBatches();
     for (int i = 0; i < batches.Count; i++)
         for (int j = 0; j < batches[i].colliders.Count; j++)
             CollisionMath.CheckN2(batches[i].colliders, batches[i].colliders);
 }
示例#2
0
 //find objects according to RAYCASTTYPE
 internal RaycastResult Raycast(Vector2 origin, Vector2 direction, RAYCASTTYPE type)
 {
     RaycastResult dynamicRes = new RaycastResult();
     RaycastResult staticRes = new RaycastResult();
     if (type == RAYCASTTYPE.DYNAMIC || type == RAYCASTTYPE.ALL)
         dynamicRes = CollisionMath.Raycast(origin, direction, dynamics);
     if (type == RAYCASTTYPE.STATIC || type == RAYCASTTYPE.ALL)
         staticRes = CollisionMath.Raycast(origin, direction, statics);
     if (!dynamicRes.hit) return staticRes;
     if (!staticRes.hit) return dynamicRes;
     if (dynamicRes.distance > staticRes.distance)
         return staticRes;
     return dynamicRes;
 }
示例#3
0
 //run objects through the batches down
 public void CheckOther(_collider col)
 {
     if (!cbound.Intersects(col))
     {
         return;
     }
     if(childs == null)
     {
         for(int i = 0; i < colliders.Count; i++)
             CollisionMath.Check(colliders[i], col);
     }
     else
     {
         for (int i = 0; i < 2; i++)
             for (int j = 0; j < 2; j++)
                 childs[i, j].CheckOther(col);
     }
 }
示例#4
0
 internal void CheckQuad()
 {
     dynamicTree.CheckSelf();//check tree against itself
     //staticTree.CheckOther(dynamics);//has bugs?
     CollisionMath.CheckN2(dynamics, statics);//quick fix
 }