public virtual void SetTransform(b2Vec2 position, float angle) { if (m_world.IsLocked == true) { return; } m_xf.q.Set(angle); m_xf.p = position; Sweep.c = b2Math.b2Mul(m_xf, Sweep.localCenter); Sweep.a = angle; Sweep.c0 = Sweep.c; Sweep.a0 = angle; b2BroadPhase broadPhase = m_world.ContactManager.BroadPhase; for (b2Fixture f = m_fixtureList; f != null; f = f.Next) { f.Synchronize(broadPhase, m_xf, m_xf); } m_world.ContactManager.FindNewContacts(); }
public virtual void SynchronizeFixtures() { /* * b2Transform xf1 = b2Transform.Identity; * xf1.q.Set(Sweep.a0); * xf1.p = Sweep.c0 - b2Math.b2Mul(xf1.q, Sweep.localCenter); * * b2BroadPhase broadPhase = World.ContactManager.BroadPhase; * for (b2Fixture f = FixtureList; f != null; f = f.Next) * { * f.Synchronize(broadPhase, ref xf1, ref Transform); * } */ b2Transform xf1; xf1.q.s = (float)Math.Sin(Sweep.a0); xf1.q.c = (float)Math.Cos(Sweep.a0); xf1.p.x = Sweep.c0.x - (xf1.q.c * Sweep.localCenter.x - xf1.q.s * Sweep.localCenter.y); xf1.p.y = Sweep.c0.y - (xf1.q.s * Sweep.localCenter.x + xf1.q.c * Sweep.localCenter.y); b2BroadPhase broadPhase = World.ContactManager.BroadPhase; for (b2Fixture f = FixtureList; f != null; f = f.Next) { f.Synchronize(broadPhase, ref xf1, ref Transform); } }
public virtual void SynchronizeFixtures() { b2Transform xf1 = b2Transform.Create(); xf1.q.Set(Sweep.a0); xf1.p = Sweep.c0 - b2Math.b2Mul(xf1.q, Sweep.localCenter); b2BroadPhase broadPhase = m_world.ContactManager.BroadPhase; for (b2Fixture f = m_fixtureList; f != null; f = f.Next) { f.Synchronize(broadPhase, xf1, m_xf); } }