A Dynamic AABB Tree is a binary search algorithm for fast overlap testing. Dynamic AABB trees are well-suited for general-purpose use and can handle moving objects efficiently. This data structure provides an effective method for detecting potential overlap between objects.
DAABBCC is not a physics engine. It does not include narrow-phase collision detection or manifold generation.
It is particularly well-suited for casual games, platformers, bullet-hell, top-down games, server-side headless builds that do not require narrow-phase collision detection.
Discussions & Release Notes
Documentation
Toss a Coin to Your Witcher
If you find my Defold Extensions useful for your projects, please consider supporting it.
I’d love to hear about your projects! Please share your released projects that use my native extensions. It would be very motivating for me.
Small but important bug fixed in core aabb.cc library. That fix cause a ~25% speed gain. Speedup might be greater for situations where there are many slow moving, or static objects
Just used this extension for the first time. Thank you @selimanac , excellent work.
I have a couple of questions.
This might be a limitation of AABB, but is there a way to detect which query result is closest to the queried position? My tests indicate that the table order is unrelated to this, probably just the order in which the entries were added to the group.
I use go.animate to move a lot of objects in a performant way. However I need to constantly update the aabb position for these objects, which means go.get_position. In my test, doing lots of updates was worse than the collision checking. Is there a way to automate these position updates to make it cheaper?
I would like to let you know that unfortunately I have no intention to update this extension anymore. But you can feel free to contribute.
You can simply check/compare positions on Lua side. It might be possible on the C, but to be honest I don’t remember.
It might be possible by using dmGameObject .
I was using go.set_positions not the go.animate. When using set_positions you don’t need to get it again. You can simply put all positions to a table and change there.
I suspected you were done with the extension, but thank you for taking the time to answer my questions anyway.
Unfortunately any C work is far beyond my expertise, so I am forced to hope someone more knowledgeable than me will take a stab at either of those features! I think they could both be really useful.
For the first point, having the C side be able to output the order of positions would be much quicker than having to do a bunch of iterations and vmath on the Lua side. For the second point, having the extension tie in with go.animate somehow would unlock huge performance potential for games with a large number of colliding objects.
Just thinking out loud, hoping to nerd snipe someone
Yes, the dmGameObject namespace has getPosition() but it requires a dmGameObject::HInstance. Not sure if there is a way to pass ids from Lua and turn them into dmGameObject::HInstance. If there is then you could provide the extension with a bunch of ids to keep updated and in the extension update function you could get the positions and update the aabb’s. @JCash will know if this is possible or not.