Custom collision
Posted
by
bali182
on Stack Overflow
See other posts from Stack Overflow
or by bali182
Published on 2012-10-12T23:47:56Z
Indexed on
2012/10/14
3:37 UTC
Read the original article
Hit count: 161
I was recently assigned to create a siple game using the Corona SDK. The main pillar of the game would be a simple event: the user should put a ball in a basket, and I should be able to handle this event.
Here is a picture for better understanding:
I successfully managed to create the collision shape for the basket, but i have trouble with the collision of the inside of this basket. My first thought was the following:
- create a new shape
- size and position it to fit the "belly" of this basket
- add it to the physics-world, and listen to the collision.
With hybrid drawing it looks like this:
But there is a problem: if i add this shape to the physics, it wouldn't let the ball fall into the, basket, it will handle this shape as a solid object as well.
So my question is: How could I get this custom object to collide, without blocking the ball to fall through it? I have read a lots of forum post with similar questions but none of them got a proper answer. There must be a way to do this in an elegant way.
And one note: Please don't suggest checking the collision manually, with rectangle intersection, because in this simple case it would work, but later I may need to change the shape of the basket, and then it will be useless!
© Stack Overflow or respective owner