Have you tried something like this: You can obviously change the numbers around if you want it to spawn on opposite side the sample below will keep your object on screen as if you had invisible walls. (good for tilt game since tilt vs "static" objects gives a lot of problems)
No, that would work - but as far as I can tell, because I am using a dynamic character, changing the characters positions directly would cause the physics to flip out (and it's a valid point).
I presume I need to grab the current linear velocity and then move the object then reapply the forces, but I'm not quite sure how to do it.
Have you tried it? I ran a sample with a dynamic character where the character is falling with gravity(0, 4.0) and when it reaches bottom of screen it appears back on top it worked fine. Not sure if same results if you using apply force or linear impulse if not I might have a work around i did in the past for one of my apps to simulate a [ Warp ]
Yeah, no I tried it - it works okay (so far). I'm asking because i've seen a post that recommends you DO NOT teleport a dynamic object while it is under impulse / moving dynamically. So i'm after the Corona recommended alternative. Now - that poster (can't find the post right now) may be incorrect - but it does jibe with my experience with physics simulations I've used in the past.
EDIT: Here is one of the lines from the docs themselves that suggests it may not be the appropriate way to do it (although, it doesn't explicitly say you can't).
Therefore, standard object read/write attributes like x, y and rotation should continue to work normally on a physical body, although if the bodyType is “dynamic”, the physics engine may “fight back” against your attempts to move the object manually, since the target object will be under the constant effect of gravity and other forces.
- Please note - the character that I am warping, is "dynamic".
EDIT x 2 - one line further down may be the answer...
The “DragPlatforms” sample code shows one method for changing body types to “kinematic” during dragging, which temporarily removes them from the influence of external forces.