protected final void synchronizeFixtures() { final Transform xf1 = pxf; xf1.R.set(m_sweep.a0); // xf1.position = m_sweep.c0 - Mul(xf1.R, m_sweep.localCenter); Mat22.mulToOut(xf1.R, m_sweep.localCenter, xf1.position); xf1.position.mulLocal(-1).addLocal(m_sweep.c0); BroadPhase broadPhase = m_world.m_contactManager.m_broadPhase; for (Fixture f = m_fixtureList; f != null; f = f.m_next) { f.synchronize(broadPhase, xf1, m_xf); } }
/** * Set the position of the body's origin and rotation. This breaks any contacts and wakes the * other bodies. Manipulating a body's transform may cause non-physical behavior. * * @param position the world position of the body's local origin. * @param angle the world rotation in radians. */ public final void setTransform(Vec2 position, float angle) { assert (m_world.isLocked() == false); if (m_world.isLocked() == true) { return; } m_xf.R.set(angle); m_xf.position.set(position); // m_sweep.c0 = m_sweep.c = Mul(m_xf, m_sweep.localCenter); Transform.mulToOut(m_xf, m_sweep.localCenter, m_sweep.c0); m_sweep.c.set(m_sweep.c0); m_sweep.a0 = m_sweep.a = angle; BroadPhase broadPhase = m_world.m_contactManager.m_broadPhase; for (Fixture f = m_fixtureList; f != null; f = f.m_next) { f.synchronize(broadPhase, m_xf, m_xf); } m_world.m_contactManager.findNewContacts(); }