Any libs for collision detection that don't work like bump.lua?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
iimurpyh
Prole
Posts: 6
Joined: Tue Feb 04, 2020 1:02 am

Any libs for collision detection that don't work like bump.lua?

Post by iimurpyh » Tue Feb 04, 2020 1:06 am

What I mean by title is a collision detection library that dosen't require every bounding box of everything in the scene to be defined beforehand. I'd perfer one where you can just call a single function with the coords/width/height/whatever of two shapes and get a bool for whether or not they're colliding.

The reason I want something like this is because I'm using Box2d, which has collision detection, but it only works if objects are moving naturally. I have a sensor that constantly gets teleported to the mouse, and there's no way to tell if things collide with that sensor using Box2d collision events!

Edit: Didn't know MouseJoint existed, the problem's now resolved. Thanks!
Last edited by iimurpyh on Wed Feb 05, 2020 12:36 am, edited 1 time in total.

Ross
Prole
Posts: 21
Joined: Tue Mar 13, 2018 12:12 pm

Re: Any libs for collision detection that don't work like bump.lua?

Post by Ross » Tue Feb 04, 2020 1:59 pm

For things like that you can use queries instead of a body. I use World:queryBoundingBox() and then, if it needs to be accurate, use Fixture:testPoint() on each fixture that I get.

User avatar
pgimeno
Party member
Posts: 2181
Joined: Sun Oct 18, 2015 2:58 pm

Re: Any libs for collision detection that don't work like bump.lua?

Post by pgimeno » Tue Feb 04, 2020 3:03 pm

iimurpyh wrote:
Tue Feb 04, 2020 1:06 am
What I mean by title is a collision detection library that dosen't require every bounding box of everything in the scene to be defined beforehand. I'd perfer one where you can just call a single function with the coords/width/height/whatever of two shapes and get a bool for whether or not they're colliding.
You can try HC.
iimurpyh wrote:
Tue Feb 04, 2020 1:06 am
The reason I want something like this is because I'm using Box2d, which has collision detection, but it only works if objects are moving naturally. I have a sensor that constantly gets teleported to the mouse, and there's no way to tell if things collide with that sensor using Box2d collision events!
If you set the velocity of the object you teleport right after you do, you might be luckier with that.

Also, maybe a mousejoint helps?

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests