Beispiel #1
0
        // These support body activation/deactivation.
        internal void CreateProxies(IBroadPhase broadPhase, ref Transform xf)
        {
            Debug.Assert(ProxyCount == 0);

            if (Shape == null)
            {
                return;
            }

            // Create proxies in the broad-phase.
            ProxyCount = Shape.ChildCount;

            for (int i = 0; i < ProxyCount; ++i)
            {
                var proxy = new FixtureProxy();
                Shape.ComputeAABB(out proxy.AABB, ref xf, i);
                proxy.Fixture    = this;
                proxy.ChildIndex = i;

                //FPE note: This line needs to be after the previous two because FixtureProxy is a struct
                proxy.ProxyId = broadPhase.AddProxy(ref proxy);

                Proxies[i] = proxy;
            }
        }
Beispiel #2
0
 internal void CreateProxies(IBroadPhase broadPhase, ref Transform xf)
 {
     Debug.Assert(this.ProxyCount == 0);
     this.ProxyCount = this.Shape.ChildCount;
     for (int i = 0; i < this.ProxyCount; i++)
     {
         FixtureProxy fixtureProxy = default(FixtureProxy);
         this.Shape.ComputeAABB(out fixtureProxy.AABB, ref xf, i);
         fixtureProxy.Fixture    = this;
         fixtureProxy.ChildIndex = i;
         fixtureProxy.ProxyId    = broadPhase.AddProxy(ref fixtureProxy);
         this.Proxies[i]         = fixtureProxy;
     }
 }
        /// <summary>
        ///     Adds a physBody to the manager.
        /// </summary>
        /// <param name="physBody"></param>
        public void AddBody(IPhysBody physBody)
        {
            if (!_bodies.Contains(physBody))
            {
                _bodies.Add(physBody);

                var proxy = new BodyProxy()
                {
                    Body = physBody
                };

                physBody.ProxyId = _broadphase.AddProxy(proxy);
            }
            else
            {
                Logger.WarningS("phys", $"PhysicsBody already registered! {physBody.Owner}");
            }
        }
Beispiel #4
0
        // These support body activation/deactivation.
        internal void CreateProxies(IBroadPhase broadPhase, ref Transform xf)
        {
            Debug.Assert(ProxyCount == 0);

            // Create proxies in the broad-phase.
            ProxyCount = Shape.ChildCount;

            for (int i = 0; i < ProxyCount; ++i)
            {
                FixtureProxy proxy = new FixtureProxy();
                Shape.ComputeAABB(out proxy.AABB, ref xf, i);

                proxy.Fixture    = this;
                proxy.ChildIndex = i;
                proxy.ProxyId    = broadPhase.AddProxy(ref proxy);

                Proxies[i] = proxy;
            }
        }
Beispiel #5
0
        // These support body activation/deactivation.
        internal void CreateProxies(IBroadPhase broadPhase, ref Transform xf)
        {
            if (ProxyCount != 0)
            {
                throw new InvalidOperationException("Proxies allready created for this Fixture.");
            }

            // Create proxies in the broad-phase.
            ProxyCount = Shape.ChildCount;

            for (int i = 0; i < ProxyCount; ++i)
            {
                FixtureProxy proxy = new FixtureProxy();
                proxy.Fixture    = this;
                proxy.ChildIndex = i;
                Shape.ComputeAABB(out proxy.AABB, ref xf, i);
                proxy.ProxyId = broadPhase.AddProxy(ref proxy.AABB);
                broadPhase.SetProxy(proxy.ProxyId, ref proxy);

                Proxies[i] = proxy;
            }
        }
Beispiel #6
0
        // These support body activation/deactivation.
        internal void CreateProxies(IBroadPhase broadPhase, ref Transform xf)
        {
            Debug.Assert(ProxyCount == 0);

            // Create proxies in the broad-phase.
            ProxyCount = Shape.ChildCount;

            for (int i = 0; i < ProxyCount; ++i)
            {
                FixtureProxy proxy = new FixtureProxy();
                Shape.ComputeAABB(out proxy.AABB, ref xf, i);

                proxy.Fixture = this;
                proxy.ChildIndex = i;
                proxy.ProxyId = broadPhase.AddProxy(ref proxy);

                Proxies[i] = proxy;
            }
        }
Beispiel #7
0
        // These support body activation/deactivation.
        internal void CreateProxies(IBroadPhase broadPhase, ref Transform xf)
        {
            Debug.Assert(ProxyCount == 0);

            // Create proxies in the broad-phase.
            ProxyCount = Shape.ChildCount;

            for (int i = 0; i < ProxyCount; ++i)
            {
                FixtureProxy proxy = new FixtureProxy();
                Shape.ComputeAABB(out proxy.AABB, ref xf, i);
                proxy.Fixture = this;
                proxy.ChildIndex = i;

                //FPE note: This line needs to be after the previous two because FixtureProxy is a struct
                proxy.ProxyId = broadPhase.AddProxy(ref proxy);

                Proxies[i] = proxy;
            }
        }