Does Obi provide the ability to query the geometry of Obi Actors, like how Physics.Raycast, .Spherecast, etc. allows you to query colliders?
I'm assuming that most of the math involved for this has already been done somewhere in there in order to support collision detection.
I see there is ObiParticlePicker, but it seems like this approach isn't optimal:
A global query would probably follow this procedure:
I'm guessing that it'd be wasteful to redo all of the work involved in calculating queries like these, given that collision tests between line simplexes and other types are already possible. (A line simplex can be treated like a raycast or a spherecast, with minor modifications.)
I'm assuming that most of the math involved for this has already been done somewhere in there in order to support collision detection.
I see there is ObiParticlePicker, but it seems like this approach isn't optimal:
- Only allows picking particles directly, instead of by their collision geometry (simplexes)
- Doesn't return a point on the surface that the ray first made contact
- Doesn't query the particle grid to filter out most of the tests
- Isn't written in efficient threaded code in the same way that other collision checks are
- Only considers one solver
- Cannot be invoked in a static way (like Physics.Raycast)
A global query would probably follow this procedure:
- Test the query condition against the oriented bounding box of each solver. If a given solver passes, then...
- Test the query condition against all occupied cells, OR, in cases where it is possible to determine which cells pass the query condition without enumerating through each cell, get a list of cells that pass the query condition. If a given cell passes, then...
- Test the query condition against all simplexes occupying the cell.
- For each simplex that passes the query condition, modify the query result.
- In the case of a Raycast, replace the current hit point if its distance from the ray is closer.
- In the case of a RaycastAll, add the hit point to the list of hit points.
- In the case of a Checksphere (which returns true if any object occupies a spherical volume, otherwise false), terminate the query and return "true" as the query result if and when a simplex passes the query condition, otherwise false. (A similar test could be done on the cell/solver bounding box itself if it is fully contained within the Checksphere volume.)
- In the case of a Raycast, replace the current hit point if its distance from the ray is closer.
I'm guessing that it'd be wasteful to redo all of the work involved in calculating queries like these, given that collision tests between line simplexes and other types are already possible. (A line simplex can be treated like a raycast or a spherecast, with minor modifications.)