Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question SphereCastAll for jobs?

Discussion in 'C# Job System' started by jeteseSA, Mar 14, 2023.

  1. jeteseSA

    jeteseSA

    Joined:
    Feb 9, 2023
    Posts:
    2
    Hello,

    I would like to use SpherecastCommand with multiple hits like the SphereCastAll in Physics but unfortunatelly this command doesn't return more than one hit per command.
    https://docs.unity3d.com/ScriptReference/SpherecastCommand.html "The result for a command at index N in the command buffer is stored at index N in the results buffer."

    Is there any other solution that I could use to have a similar result?

    I thought to use RaycastCommand that returns multiple hits per command but it's not good enough unless I throw a lot of them to recreate the sphere cast behaviour.
    https://docs.unity3d.com/ScriptReference/RaycastCommand.html "The result for a command at index N in the command buffer will be stored at index N * maxHits in the results buffer."

    Thank you so much!
     
  2. jeteseSA

    jeteseSA

    Joined:
    Feb 9, 2023
    Posts:
    2
    Last edited: Mar 16, 2023
  3. Haxel0rd

    Haxel0rd

    Joined:
    May 20, 2021
    Posts:
    49