DAABBCC - Dynamic Tree(aka AABB Tree) native extension for fast AABB collision detection

I have found the same issue for: daabbcc.insert_aabb and daabbcc.insert_gameobject.

Another question. It seems to me that the query methods return nil also for count when there is no collision. Should it be better to return count = 0? Of course, this is not important at all.

Thank you for your work with this extension!

1 Like

Thank you; I fixed those typos

You’re right; it should actually return 0. I’ll check it now

1 Like

I recently updated the entire library and missed that. I’ve updated the v3.x branch with the fix. Counts should return 0 now for all queries and raycast results.

5 Likes

Thank you for this extension!

I’m testing it now and it’s super easy to check for collisions with AABBs and check raycasts! Here’s a super quick example of using one area to change character’s acceleration and friction!

:blue_square: Blue AABB marks an area, where character behaves like on ice :ice_cube: :smiley:
:red_square: Red is character’s AABB.
:yellow_square: Yellow is character’s velocity.

7 Likes

Hi @selimanac

I would be interested in having an aabb linked to the world_position of a game object. Indeed I have an animated hierarchy of game objects and I need an aabb tracking a game object that is not the root of the hierarchy. (I hope this make sense).

Do you think you could implement this? If this is not possible, I will change the design and track the root of the hierarchy.

Thank you in any case! And thank you for this amazing extension!

Ciao!

If I understand correctly, you want me to use get_world_position instead of get_position for AABBs, right?

Do you want to use the world position for every game object or just some? I think I can handle both cases by adding an optional boolean (world or local) to insert_gameobject and new_group. Does this work for you?

This should be easy to add, maybe today or within the next couple of days. :slight_smile:

3 Likes

@selimanac Thank you for your kind answer!

Yes, I need get_worid_position instead of get_pposition. Not for every game object, just for some of them. So I would say that a boolean in insert_game_object would be perfect.

I hope this does not create performance problem…

Thank you again!

1 Like

I’ve updated the v3.x branch with an optional get_world_position.
I haven’t updated the documentation yet; I’d like you to try it first. If it works for you, I’ll proceed with updating the docs.

The last argument of aabbcc.insert_gameobject is now a optional get_world_position flag (boolean: true/false). The default value is false.

local aabb_id = daabbcc.insert_gameobject(group_id, go_url, width, height, collision_bits.ENEMY, true)
-- OR , if you are not using collision bits:
local aabb_id = daabbcc.insert_gameobject(group_id, go_url, width, height, nil, true)

I don’t think so; the impact should be minimal. C/C++ is incredibly fast, so I’m not too concerned about these kinds of condition checks. :slightly_smiling_face:

3 Likes

@selimanac Thank you soooo much!

The option flag seems to work fine for me! Great!

1 Like