Page 1 of 1

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

Posted: Tue Feb 04, 2020 1:06 am
by iimurpyh
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!

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

Posted: Tue Feb 04, 2020 1:59 pm
by Ross
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.

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

Posted: Tue Feb 04, 2020 3:03 pm
by pgimeno
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?