move an object after or during collision

I want to move an object either during or after a collision to an arbitrary point. For example, when a box hits the ground, I want to move it back up to the top of the screen.

Take the “CollisionDetection” sample program.

If I add the following into the onLocalCollision function:
self.x = 0
self.y = 0
It gives the following error:
“ERROR: Cannot translate an object before collision is resolved.”

So instead, I add those same two lines to the onLocalPostCollision function instead (which is supposed to be called right after the collision has been resolved). But, the same error happens.

Thanks!

Pete [import]uid: 34723 topic_id: 6071 reply_id: 306071[/import]

set a flag in your collision event. process the flag in your enterframe [import]uid: 6645 topic_id: 6071 reply_id: 20830[/import]

I am very new at this and am having the same problem. I tried to find the answer, but was unable to collision resolution or whatever needs to be done.

Would you mind posting an example? Thanks so much. [import]uid: 33005 topic_id: 6071 reply_id: 23958[/import]

i’ve posted a bug report on this.
http://developer.anscamobile.com/forum/2011/02/20/postcollision-does-not-fire-after-collision-has-been-completely-resolved

it may not be a bug specifically but if it’s not then this statement in the example code is not true


This new event type fires only after a collision has been completely resolved

[import]uid: 6645 topic_id: 6071 reply_id: 23972[/import]