Box2D.Dynamics.Body.SetTransform C# (CSharp) Method

SetTransform() public method

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.
public SetTransform ( Vec2 position, float angle ) : void
position Box2D.Common.Vec2 the world position of the body's local origin.
angle float the world rotation in radians.
return void
        public void SetTransform(Vec2 position, float angle)
        {
            Debug.Assert(World.Locked == false);
            if (World.Locked)
            {
                return;
            }

            Xf.Q.Set(angle);
            Xf.P.Set(position);

            // m_sweep.c0 = m_sweep.c = Mul(m_xf, m_sweep.localCenter);
            Transform.MulToOutUnsafe(Xf, Sweep.LocalCenter, Sweep.C);
            Sweep.A = angle;

            Sweep.C0.Set(Sweep.C);
            Sweep.A0 = Sweep.A;

            BroadPhase broadPhase = World.ContactManager.BroadPhase;
            for (Fixture f = FixtureList; f != null; f = f.Next)
            {
                f.Synchronize(broadPhase, Xf, Xf);
            }

            World.ContactManager.FindNewContacts();
        }