Hi there,
I'm basically trying do do a kind of teleport when an object hits another.
I'm using the physics-engine for collision-detection.
So first I created a 'door' which teleports an object to another 'door'.
The door has the isSensor-flag enabled and correctly detects a collision with the (moving) object. If I just try to change the x/y-coordinates as soon as the collision begins, I get an 'Cannot translate an object before collision is resolved'-Error. So far so good. I first tried to simply pause physics using physics.pause(), do the translation and the restart physics again, but that didn't work (same error). I then tried to delete the object on collision using object:removeSelf(), then created the object again at its new position and added the physics-body again.
This worked, but the physics-body is not added to the object again, therefore no collisions anymore..
What am I doing wrong, how can I add the body to the object again or what is a better way to do the translation during the collision?
And btw, the object is moving through the sensor during the collision by adding vals to the object.x-value, how comes this is possible, while doing so for the teleport throws out the error-message?
Hope you got what I mean...
Greets,
Dschonny