How to set so it only detects a collision from the top of the object

I though I saw this somewhere in the documentation a while ago but I can’t remember where but, basically I want to only detect a collision from the top. so you can go through it from the bottom but, not from the top. [import]uid: 12041 topic_id: 4182 reply_id: 304182[/import]

i dont know the exact method but i believe you’ll want to override the collision in a pre-collision event, based on the .y value of your object compared to the cloud/platform etc.

my guess is you either “return true” to say the event is handled and stop further propagation. or you set the collision filter/index dynamically. ie if it’s above the platform make it collide with it

actually ansca suggest a different method, using isSensor on your character
http://developer.anscamobile.com/forum/2010/09/06/one-sided-collisions#comment-5879
[import]uid: 6645 topic_id: 4182 reply_id: 13002[/import]

Yes, basically I think the idea is that you have a regular collision event but check the x,y coords of the two colliding objects as relative to each other to determine if one is “above” the other or even within a certain, specific area.

To that end, if you want to simply have a collision event fire when an object enters a specific area (whether that is a general place in the ‘world’ or just a particular ‘part’ of a larger object) you can add a body to your physics object and make it a sensor (‘isSensor=true’) to fire a collision event but have no physical effect otherwise.

Matt. [import]uid: 8271 topic_id: 4182 reply_id: 13177[/import]

This thread should come in handy, thanks. I also asked this question late last month both here and to Corona support but didn’t receive an answer yet.
( https://developer.anscamobile.com/forum/2010/11/26/how-create-platforms-player-can-jump-otherwise-walk-through-using-precollision )

If anyone happens to have some sample code, it would also be cool. I’m also a bit unsure now which of the three suggested methods – overriding the propagation of the collision event vs turning the character into a sensor for two seconds vs setting the collision filter dynamically – is better? [import]uid: 10284 topic_id: 4182 reply_id: 13197[/import]

That really depends on your situation/game/app - but that will have to be your own investigation…

m [import]uid: 8271 topic_id: 4182 reply_id: 13216[/import]