コード例 #1
0
 public void PopulateCache(ContactCache cache)
 {
     cache.Clear();
     for (int i = 0; i < _items.Length; i++)
     {
         for (int j = 0; j < _items[i].Count; j++)
         {
             cache.Add(_items[i][j]);
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Initialize the physics implementation.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            if (_broadPhase == null)
            {
                _broadPhase = new SweepAndPrune();
            }

            _islandAlloc  = new Pool <Island>(_islandPoolCapacity, 2);
            _contacts     = new BodyCollisionFunctor(this);
            _contactCache = new ContactCache(new ContactCache.Allocator(_contactPoolCapacity, 2, _maxPointsPerContact));
            _taskManager  = TaskManager.Current;

            _generators.Add(_gravityForce);
        }