예제 #1
0
        /// <summary>
        ///     Tests a physBody against every other registered physBody.
        /// </summary>
        /// <param name="physBody">Body being tested.</param>
        /// <param name="colliderAABB">The AABB of the physBody being tested. This can be IPhysBody.WorldAABB, or a modified version of it.</param>
        /// <param name="results">An empty list that the function stores all colliding bodies inside of.</param>
        internal void DoCollisionTest(IPhysBody physBody, Box2 colliderAABB, List <IPhysBody> results)
        {
            // TODO: Terrible hack to fix bullets crashing the server.
            // Should be handled with deferred physics events instead.
            if (physBody.Owner.Deleted)
            {
                return;
            }

            _broadphase.Query((delegate(int id)
            {
                var body = _broadphase.GetProxy(id).Body;

                // TODO: Terrible hack to fix bullets crashing the server.
                // Should be handled with deferred physics events instead.
                if (body.Owner.Deleted)
                {
                    return(true);
                }

                if (TestMask(physBody, body))
                {
                    results.Add(body);
                }

                return(true);
            }), colliderAABB);
        }