Need Guidance: Top-Down Floor-plan collision for walls

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
User avatar
severedskullz
Prole
Posts: 36
Joined: Thu May 30, 2013 1:55 am

Need Guidance: Top-Down Floor-plan collision for walls

Post by severedskullz »

Hello everyone,

I was hoping to find some guidance on top down collision for interior terrain such as this:
Image

I don't think my game would be highly that complex regarding clutter on the game area, but I do imagine there will be sufficient amounts of walls and boxes for players to collide with. How would I go about coding something like this?

Would Box2D be able to do something like this? I haven't messed with that yet.
User avatar
Plu
Inner party member
Posts: 722
Joined: Fri Mar 15, 2013 9:36 pm

Re: Need Guidance: Top-Down Floor-plan collision for walls

Post by Plu »

Box2D is a full physics engine, it might be able to do this but it'll do a lot of other stuff as well. I'm also not sure if Box2D even works with a top down approach...

You probably need a collision detection engine like HardonCollider or maybe Bump if you're mostly working with rectangles like your example image.

Those can detect collisions for you, and you can add your own logic for resolving them (for bumping into walls, mostly just moving the player backwards a bit)
User avatar
severedskullz
Prole
Posts: 36
Joined: Thu May 30, 2013 1:55 am

Re: Need Guidance: Top-Down Floor-plan collision for walls

Post by severedskullz »

Plu wrote:Box2D is a full physics engine, it might be able to do this but it'll do a lot of other stuff as well. I'm also not sure if Box2D even works with a top down approach...

You probably need a collision detection engine like HardonCollider or maybe Bump if you're mostly working with rectangles like your example image.

Those can detect collisions for you, and you can add your own logic for resolving them (for bumping into walls, mostly just moving the player backwards a bit)
You know the funny thing is I have seen HardonCollider mentioned literally dozens of times but I never knew it was for collisions. I'll check it out.
User avatar
seanmd
Prole
Posts: 35
Joined: Sat Jun 22, 2013 7:47 am

Re: Need Guidance: Top-Down Floor-plan collision for walls

Post by seanmd »

I used the box2d mappings in my game, which is also a top-down, so I can say for certain that love.physics can certainly accomplish what you want. You need to either build a bunch of edge shapes (that's what I'm using in my game) or polygon shapes (cannot be concave, no more than 8 points)

That said, you may not need something so heavyweight considering your needs.
Post Reply

Who is online

Users browsing this forum: No registered users and 73 guests