Page 1 of 1

Pass-through edges

Posted: Sun Nov 09, 2008 3:46 pm
by singpolyma
I'd really like to be able to set certain edges as pass-through (ie, so a character can jump up through a platform and then land on top)

Re: Pass-through edges

Posted: Sun Nov 09, 2008 6:06 pm
by slembcke
I'd like to do this too. Unfortunately I haven't really figured out how yet. :(

Because Chipmunk allows a small amount of overlap, it makes it difficult to determine if you should let it fall back through because it never made it all the way though, or if you should push it back up because it's resting on top.

Re: Pass-through edges

Posted: Wed Nov 12, 2008 5:19 pm
by Michael Buckley
It seems to me like that could be handled in a collision function. Test the velocity of the character (up or down) and whether or not its y-position is high enough. Of course, like Scott said, there is some overlap, so it's hard to tell, but in general, if an object is falling from above, it will have a greater downward velocity. If the downward velocity is small, it probably recently hit the top of its arc and hasn't fallen very far in the last step, so even if the bottom of the character is below the top of the platform, depending on how far below, you could consider it to be on top.

Re: Pass-through edges

Posted: Thu Nov 27, 2008 7:49 am
by bluescrn
Just found this thread after posting about the same thing...

Got an idea for doing it using layers, but handling the switch between layers is a bit arkward (you don't want to turn a layer on whilst your player/object is intersecting an edge in that layer)

http://www.slembcke.net/forums/viewtopic.php?f=1&t=329