Call `SetTransform` *before* or *after* your `World::step` call. Make sure it's not inside a Box2D callback, as those happen *inside* the `step`, during which the `World` is locked.

- - -

Further details:

The `isLocked() == false` assert implies you're attempting to directly change something in the Box2D `World` *during a simulation step*. This could break the simulation, so Box2D guards against it. `SetTransform` directly changes the body's position, so it is disallowed when locked.

`ApplyLinearImpulse` works even when locked, because all it does is register a new impulse that should act on the body, which does not directly change anything. The impulse is only applied on the next world step.