Problem Setting XForm On Contact

I'm still trying to get the hang of Box2d so this may be an obvious one.

So I'm trying to make "teleporters" that when an object hits one of them, the object is transported to the teleporter's partner teleporter.
I set up a body as a sensor and added an if statement in the Contact Listener to look for when an object hits the sensor. That all works fine.

The problem is that when I try to set the XForm of the object that is hitting the sensor nothing happens. It returns true when I use the function
but its coordinates do not change.

I'm not really sure whats wrong there, but I'm thinking it would be that the world is locked.

(TL;DR: Making a teleporter, using contact Listener to set XForm on contacts. Setting XForm does nothing. Help.)

Any help on how to accomplish would be greatly appreciated.
Well it's not in the documentation AFAIK, but yeah there is some world locking mechanism going on. As the manual advises, if you are going to alter the world, you should buffer the contacts the listener recieves, and process them after the physics is done. It's probably stopping you because it would mess stuff up.

Here's the relevant code, from b2Body.cpp (world.m_lock is true for the duration of Step):
Code:
314    b2Assert(m_world->m_lock == false);
315    if (m_world->m_lock == true)
316    {
317       return true;
318    }
It should be hitting an assert, surely?
The assert is noted out in the AS3 version of b2Body (Asserts not used at all maybe?).

But yeah, I was lazy and didn't implement any form of buffering ( as it was possible to add forces to the objects in the contact listener ).
So, I guess I'll have to be un-lazy and implement it.

If I just removed the check for if the world is locked ( in b2Body - SetXForm() ), would the engine mess up in any way?
I know I'd have to keep my points in valid positions when I set anything, but I'm only going to be using SetXForm for the teleporters.

I guess I should research even more before I ask questions really.

Thanks.
I have the same problem. If you found solution, please, show it.

Thanks
This is an old thread, and he did find a solution. You have to use the SetXForm() outside of the contact listener because the contact listener is done during a physics step. You have to use SetXForm() outside of the step.

Original thread: https://box2d.org/forum/viewtopic.php?t=783