Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Multi-hit versions of physics cast commands

Discussion in 'DOTS Physics' started by XaneFeather, Sep 24, 2019.

  1. XaneFeather

    XaneFeather

    Joined:
    Sep 4, 2013
    Posts:
    90
    Hello there!

    While writing a tool that required a lot of Spherecasts to determine what objects surround other objects, I looked into the job commands for physics casts to see if I can parallelize that aspect. However, I noticed that while there is a multi-hit version of RaycastCommand (maxHit parameter), Spherecast, Boxcast and Capsulecast only support single-hit results.

    Are there any plans to add multi-hit support for the other casts?
     
  2. Abbrew

    Abbrew

    Joined:
    Jan 1, 2018
    Posts:
    297
    The multi-hit property of RaycastCommand does not work. However, the experimental Unity.Physics package offers an API that has multi-hit queries. The method I believe is CollisionWorld.CastX(XInput input, ref NativeList<XHit> allHits). It seems to fill the NativeList with all hits whether it's a raycast or spherecast. Hope this helps
     
unityunity