Example #1
0
    internal void SynchronizeFixtures()
    {
        b2Transform xf1 = new b2Transform();

        xf1.q.Set(m_sweep.a0);
        xf1.p = m_sweep.c0 - Utils.b2Mul(xf1.q, m_sweep.localCenter);

        b2BroadPhase broadPhase = m_world.m_contactManager.m_broadPhase;

        for (b2Fixture f = m_fixtureList; f != null; f = f.m_next)
        {
            f.Synchronize(broadPhase, xf1, m_xf);
        }
    }
Example #2
0
    /// Set the position of the body's origin and rotation.
    /// Manipulating a body's transform may cause non-physical behavior.
    /// Note: contacts are updated on the next call to b2World::Step.
    /// @param position the world position of the body's local origin.
    /// @param angle the world rotation in radians.
    public void SetTransform(b2Vec2 position, float angle)
    {
        Debug.Assert(m_world.IsLocked() == false);
        if (m_world.IsLocked() == true)
        {
            return;
        }

        m_xf.q.Set(angle);
        m_xf.p = position;

        m_sweep.c = Utils.b2Mul(m_xf, m_sweep.localCenter);
        m_sweep.a = angle;

        m_sweep.c0 = m_sweep.c;
        m_sweep.a0 = angle;

        b2BroadPhase broadPhase = m_world.m_contactManager.m_broadPhase;

        for (b2Fixture f = m_fixtureList; f != null; f = f.m_next)
        {
            f.Synchronize(broadPhase, m_xf, m_xf);
        }
    }