Wednesday, October 9, 2019

2D collision-detection middleware



(This question was split off from 3D collision-detection middleware)



Are there any recommendable middleware available for 2D collision detection?


I believe I've heard that Box2D could be used for collision detection without the physics part. I'd like to hear if people have any experiences on Box2D or others libraries for 2D collision detection specifically.



Answer



I had SEVERE issues with Box2D collision detection...


Mostly, because Box2D collision detect broadphase is a binary tree, everything that use collision (even if they don't use physics) need to update that tree, and then the tree need to be searched back.


For few objects with bizarre size differences (like a golf ball and a bus), Box2D is acceptable, or even fast, but for various objects of roughly the same size (like you would have in a clone of asteroids, or in a tile-based game, or anything like that) then it behaves extremely slow, even unstable sometimes as it need to write and read massive amounts of data on the tree.


Chipmunk Physics fix this, they use a spatial hashing thing, that I really don't understand how it work, but it work!


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...