Open tony-topper opened 2 years ago
Hi @tony-topper, thanks for the feedback!
I think it depends on your setup. I need more information regarding the collisions (targets) and the objects (dynamics/static). BurstCollections
already has implemented an efficient tree vs tree and AABB vs tree query.
I am trying to calculate when things, mostly the player, are behind tree branches.
I assume that these objects can be represented with triangle mesh, so using tree vs tree as a broad-phase could be a natural thing to do. To solve the narrow-phase you have a few options: (a) checking if point is in triangle (b) triangle-triangle intersection check (c) edge-edge intersection check (d) ...
I have some collision algorithms in PBD2D
package. All predicted collisions are generated from tree vs tree collisions. It works pretty well on targets with many triangles.
After our discussion on a different thread, I guess that you are using the Unity.Jobs
pipeline. I think that using using MeshCollider
would be slower than writing a burst job with NativeBoundingVolumeTree
. So this could be an advantage to NativeBoundingVolumeTree
.
I hope this helps!
Best, Andrzej
Thanks so much for the reply @andywiecko. This is very helpful. At the moment I am a solo dev, so it's nice to get someone else's perspective.
I think going the Unity.Jobs
route will make sense. Now I need to find the quickest way to build an array of items in the bounding tree. Many thanks.
I'm glad that I could help. I really appreciate your feedback. Your contributions to my projects make them better.
Now I need to find the quickest way to build an array of items in the bounding tree. Many thanks.
In my PBD2D I have an abstract system for updating tree volumes for different objects (triangles, points, edges, etc.). It uses the IConvertableToAABB
interface. You can check my readonly struct Triangle : IConvertableToAABB
implementation.
Trying to get some insight on which route I want to take on something.
You see the set of bounding boxes I've created here. Debating between just creating a mesh with triangles and using a Mesh Collider or using your AABB bounding boxes in the NativeBoundingVolumeTree to determine collisions.
Do you have any insight on what the performance differences would be here? Unity says this is how the Mesh Collider works: https://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/guide/Manual/Geometry.html
I am trying to calculate when things, mostly the player, are behind tree branches.