示例#1
0
 public CollisionWorld(INarrowphase narrowphase, IBroadphase broadphase)
 {
     _colliders        = new List <CollisionBody>(200);
     _broadphase       = broadphase;
     _narrowphase      = narrowphase;
     _forceUpdateAABBs = true;
 }
示例#2
0
 public CollisionWorld(INarrowphase narrowphase, IBroadphase broadphase)
 {
     _colliders = new List<CollisionBody>(200);
     _broadphase = broadphase;
     _narrowphase = narrowphase;
     _forceUpdateAABBs = true;
 }
示例#3
0
        public World(BeatEmUpGame game, IBroadphase bp, INarrowphase np)
        {
            this.game = game;
            if (bp == null)
            {
                throw new ArgumentException("broadphase can not be null!", "bp");
            }

            if (np == null)
            {
                throw new ArgumentException("narrowphase can not be null!", "np");
            }
            Broadphase  = bp;
            Narrowphase = np;
            colliders   = new List <Body>(128);
        }
示例#4
0
 public override void UpdateAabbs()
 {
     for (int i = 0; i < CollisionObjects.Count; i++)
     {
         CollisionObject colObj = CollisionObjects[i];
         RigidBody       body   = RigidBody.Upcast(colObj);
         if (body != null)
         {
             if (body.IsActive && (!body.IsStaticObject))
             {
                 Vector3 minAabb, maxAabb;
                 colObj.CollisionShape.GetAabb(colObj.WorldTransform, out minAabb, out maxAabb);
                 IBroadphase bp = Broadphase;
                 bp.SetAabb(body.Broadphase, minAabb, maxAabb);
             }
         }
     }
 }
示例#5
0
 public void DefineWorld(int width, int height, int size)
 {
     _broadphase = new UniformGridBroadphase(width, height, size);
 }
示例#6
0
 public void DefineWorld(int width, int height, int size)
 {
     _broadphase = new UniformGridBroadphase(width, height, size);
 }
示例#7
0
 public PhysicsWorld()
 {
     // Switch the collision system here:
     //broadphase = new CollisionSystemSap();
     broadphase = new DynamicBoundsTree();
 }