setTransform method

void setTransform (Vector2 position, double angle)

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. Note: contacts are updated on the next call to World.step().

@param position the world position of the body's local origin. @param angle the world rotation in radians.


void setTransform(Vector2 position, double angle) {
  assert(world.isLocked() == false);
  if (world.isLocked() == true) {


  // _sweep.c0 = _sweep.c = Mul(_xf, _sweep.localCenter);
  Transform.mulToOutUnsafeVec2(_transform, _sweep.localCenter, _sweep.c);
  _sweep.a = angle;

  _sweep.a0 = _sweep.a;

  BroadPhase broadPhase = world._contactManager.broadPhase;
  for (Fixture f = _fixtureList; f != null; f = f._next) {
    f.synchronize(broadPhase, _transform, _transform);