Hey everyone!
We have been working on upgrading batch queries and their usability, and we would like to share an early access to it: https://beta.unity3d.com/download/cc7681295a53/public_download.html
Here are the things that were changed:
-
maxHits property was moved to the ScheduleBatch method. Now you can have a job for setting up commands without touching the main thread.
-
maxHits now properly works with all batch commands. Additionally, it’s guaranteed that you will get the closest hit if you set maxHits to 1.
-
We enabled support of multiple hits per 1 mesh.
-
We have introduced a new struct called QueryParameters for an easier and more configurable way of setting up commands.
-
We also changed signatures for all command structs:
Old signature of RaycastCommand:
RaycastCommand(Vector3 from, Vector3 direction, float distance, int layerMask, int maxHits)
New signature:
RaycastCommand(Vector3 from, Vector3 direction, QueryParameters queryParameters, float distance).
-
QueryParameters struct
-
LayerMask was moved to this structure.
-
Additionally we now support different options for batch queries:
-
Hit triggers - whether triggers return a hit.
-
Hit backfaces - whether backfaces return a hit…
-
Multiple hits per mesh - whether a single mesh can return multiple hits.
-
QueryParameters.Default is available for easier use with default values.
We are attaching a demo project we’ve prepared for you to showcase how new batch queries are functioning.
Also, would like to mention that this feature is going to be a part of the alpha release and will be available in 2022.2.0a6 and up.
Your feedback is greatly appreciated!
7895746–1005544–BatchQueryDemo.zip (40.9 KB)