/// <summary> /// Internal method /// </summary> /// <param name="broadPhase"></param> /// <param name="transform1"></param> /// <param name="transform2"></param> protected internal void Synchronize(BroadPhase broadPhase, Transform transform1, Transform transform2) { if (ProxyCount == 0) { return; } for (int i = 0; i < ProxyCount; ++i) { FixtureProxy proxy = Proxies[i]; // Compute an AABB that covers the swept shape (may miss some rotation effect). AABB aabb1 = pool1; AABB aab = pool2; Shape.ComputeAABB(aabb1, transform1, proxy.ChildIndex); Shape.ComputeAABB(aab, transform2, proxy.ChildIndex); proxy.AABB.LowerBound.X = aabb1.LowerBound.X < aab.LowerBound.X ? aabb1.LowerBound.X : aab.LowerBound.X; proxy.AABB.LowerBound.Y = aabb1.LowerBound.Y < aab.LowerBound.Y ? aabb1.LowerBound.Y : aab.LowerBound.Y; proxy.AABB.UpperBound.X = aabb1.UpperBound.X > aab.UpperBound.X ? aabb1.UpperBound.X : aab.UpperBound.X; proxy.AABB.UpperBound.Y = aabb1.UpperBound.Y > aab.UpperBound.Y ? aabb1.UpperBound.Y : aab.UpperBound.Y; displacement.X = transform2.P.X - transform1.P.X; displacement.Y = transform2.P.Y - transform1.P.Y; broadPhase.MoveProxy(proxy.ProxyId, proxy.AABB, displacement); } }
internal bool Synchronize(BroadPhase broadPhase, Transform Transform1, Transform Transform2) { if (_proxyId == PairManager.NullProxy) { return(false); } // Compute an AABB that covers the swept shape (may miss some rotation effect). AABB aabb1, aabb2; _shape.ComputeAABB(out aabb1, Transform1); _shape.ComputeAABB(out aabb2, Transform2); AABB aabb = new AABB(); aabb.Combine(aabb1, aabb2); if (broadPhase.InRange(aabb)) { broadPhase.MoveProxy(_proxyId, aabb); return(true); } else { return(false); } }
/// <summary> /// Describes whether this instance synchronize /// </summary> /// <param name="broadPhase">The broad phase</param> /// <param name="transform1">The transform</param> /// <param name="transform2">The transform</param> /// <returns>The bool</returns> internal bool Synchronize(BroadPhase broadPhase, XForm transform1, XForm transform2) { if (ProxyId == PairManager.NullProxy) { return(false); } // Compute an AABB that covers the swept shape (may miss some rotation effect). Aabb aabb1, aabb2; Shape.ComputeAabb(out aabb1, transform1); Shape.ComputeAabb(out aabb2, transform2); Aabb aabb = new Aabb(); aabb.Combine(aabb1, aabb2); if (broadPhase.InRange(aabb)) { broadPhase.MoveProxy(ProxyId, aabb); return(true); } return(false); }
private void MoveProxy() { Random rnd = new Random(888); for (int i = 0; i < k_actorCount; ++i) { int j = (rnd.Next() % k_actorCount); //int32 j = 1; Actor actor = _actors[j]; if (actor.proxyId == PairManager.NullProxy) { continue; } MoveAABB(ref actor.aabb); _broadPhase.MoveProxy(actor.proxyId, actor.aabb); return; } }
public void Synchronize(BroadPhase broadPhase, Transform transform1, Transform transform2) { if (ProxyId == BroadPhase.NullProxy) { return; } // Compute an AABB that covers the swept shape (may miss some rotation effect). AABB aabb1, aabb2; Shape.ComputeAABB(out aabb1, ref transform1); Shape.ComputeAABB(out aabb2, ref transform2); Aabb.Combine(aabb1, aabb2); Vec2 displacement = transform2.Position - transform1.Position; broadPhase.MoveProxy(ProxyId, Aabb, displacement); }
internal void Synchronize(BroadPhase broadPhase, ref Transform transform1, ref Transform transform2) { if (ProxyCount == 0) { return; } for (int i = 0; i < ProxyCount; ++i) { FixtureProxy proxy = Proxies[i]; // Compute an AABB that covers the swept Shape (may miss some rotation effect). AABB aabb1, aabb2; Shape.ComputeAABB(out aabb1, ref transform1, proxy.ChildIndex); Shape.ComputeAABB(out aabb2, ref transform2, proxy.ChildIndex); proxy.AABB.Combine(ref aabb1, ref aabb2); Vector2 displacement = transform2.Position - transform1.Position; broadPhase.MoveProxy(proxy.ProxyId, ref proxy.AABB, displacement); } }
internal void Synchronize(BroadPhase broadPhase, ref XForm transform1, ref XForm transform2) { if (_proxyId == BroadPhase.NullProxy) { return; } // Compute an AABB that covers the swept shape (may miss some rotation effect). AABB aabb1, aabb2; _shape.ComputeAABB(out aabb1, ref transform1); _shape.ComputeAABB(out aabb2, ref transform2); AABB aabb = new AABB(); aabb.Combine(ref aabb1, ref aabb2); broadPhase.MoveProxy(_proxyId, ref aabb); }
internal void Synchronize(BroadPhase broadPhase, ref Transform transform1, ref Transform transform2) { if (ProxyCount == 0) { return; } for (int i = 0; i < ProxyCount; ++i) { FixtureProxy proxy = Proxies[i]; // Compute an AABB that covers the swept Shape (may miss some rotation effect). AABB aabb1, aabb2; Shape.ComputeAABB(out aabb1, ref transform1, proxy.ChildIndex); Shape.ComputeAABB(out aabb2, ref transform2, proxy.ChildIndex); proxy.AABB.Combine(ref aabb1, ref aabb2); Vector2 displacement = transform2.Position - transform1.Position; broadPhase.MoveProxy(proxy.ProxyId, ref proxy.AABB, displacement); } }
internal void Synchronize(BroadPhase broadPhase, Transform transform1, Transform transform2) { //broadphase was pointer if (m_proxies.Count() == 0) { return; } for (int i = 0; i < m_proxies.Count(); ++i) { FixtureProxy proxy = m_proxies[i]; // Compute an AABB that covers the swept shape (may miss some rotation effect). AABB aabb1, aab; m_shape.ComputeAABB(out aabb1, transform1, proxy.childIndex); m_shape.ComputeAABB(out aab, transform2, proxy.childIndex); proxy.aabb.Combine(aabb1, aab); Vec2 displacement = transform2.p - transform1.p; broadPhase.MoveProxy(proxy.proxyId, proxy.aabb, displacement); } }
internal void Synchronize(BroadPhase broadPhase, ref Transform transform1, ref Transform transform2) { if (_proxyId == BroadPhase.NullProxy) { return; } // Compute an AABB that covers the swept shape (may miss some rotation effect). AABB aabb1, aabb2; _shape.ComputeAABB(out aabb1, ref transform1); _shape.ComputeAABB(out aabb2, ref transform2); _aabb.Combine(ref aabb1, ref aabb2); Vector2 displacement = transform2.Position - transform1.Position; broadPhase.MoveProxy(_proxyId, ref _aabb, displacement); }