Page 1 of 1

collision with complexe shapes

Posted: Tue Apr 04, 2017 1:33 pm
by Shaoth
Hello,

I need some help to determine which method I can use to detect collision between my player and the decor.
The decor is not only composed by rectangles (even if we can always use little ones to make the job but it is so hard to declare them…)
For exemple see the capture bellow.
The player can only move in the red zone.
Finally, the decor can be very more detailed with complexe shape.

I’d like to know if you have some feedback about this problem.

Thank you for your answers !

Re: collision with complexe shapes

Posted: Tue Apr 04, 2017 2:19 pm
by DireMitten
If you use Box2D (which is what love.physics is), you can use Edge shapes instead of Rectangles. These are essentially just lines, so you only have to give it two points for each edge in your shape.

You can also use Polygon shapes, but they are limited to at most 8 points, and have to be convex, so it wouldn't really be very useful in your situation.

Re: collision with complexe shapes

Posted: Tue Apr 04, 2017 6:22 pm
by Shaoth
Ok, I have not look to love.physics yet but I will do it this night !
Thank you.