Hello,
I'm implementing a wrap around screen. I've set up horizontal and vertical sensors around the edges (just outside the visible screen area), they are 0.1xworld height/width.
When I get a collision with the sensor and the object is travelling in the correct direction (to avoid it raising a collision again on the other side) I set a flag and after the world step I call setxform to position the object on the other side of the screen (and past the sensor).
What is happening is after I call setxform the object thinks it has hit something (no matter where on the vertical plane) and bounces back a little. It then lets the object carry on as normal.
It creates the bounce back wherever I call setxform. In the picture below/attached when the green ball (number 1) hits the sensor on the left I call setxform after world step and position it at position 2. It then thinks it has collided with the dotted line and bounces back before continuing as normal.
If I remove the sensors and just check for the object's position followed by calling setxform, all is well.
It's as if after I call setxform it thinks it has still collided with the left hand sensor but it is a real body.
Any idea?
I'm implementing a wrap around screen. I've set up horizontal and vertical sensors around the edges (just outside the visible screen area), they are 0.1xworld height/width.
When I get a collision with the sensor and the object is travelling in the correct direction (to avoid it raising a collision again on the other side) I set a flag and after the world step I call setxform to position the object on the other side of the screen (and past the sensor).
What is happening is after I call setxform the object thinks it has hit something (no matter where on the vertical plane) and bounces back a little. It then lets the object carry on as normal.
It creates the bounce back wherever I call setxform. In the picture below/attached when the green ball (number 1) hits the sensor on the left I call setxform after world step and position it at position 2. It then thinks it has collided with the dotted line and bounces back before continuing as normal.
If I remove the sensors and just check for the object's position followed by calling setxform, all is well.
It's as if after I call setxform it thinks it has still collided with the left hand sensor but it is a real body.
Any idea?