collision with complexe shapes

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Shaoth
Prole
Posts: 6
Joined: Tue Apr 04, 2017 10:09 am

collision with complexe shapes

Post 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 !
Attachments
example.png
example.png (38.49 KiB) Viewed 2549 times
DireMitten
Prole
Posts: 9
Joined: Thu Jun 23, 2016 3:07 pm

Re: collision with complexe shapes

Post 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.
Shaoth
Prole
Posts: 6
Joined: Tue Apr 04, 2017 10:09 am

Re: collision with complexe shapes

Post by Shaoth »

Ok, I have not look to love.physics yet but I will do it this night !
Thank you.
Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot], Google [Bot] and 3 guests