Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

using DOTS physics for world query

Discussion in 'Physics for ECS' started by laurentlavigne, Aug 20, 2020.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,108
    Can I query the world graph directly without spherecasting?
    For performance,
    for AI
     
  2. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    Can you explain a bit more what exactly do you need? For example, what do you mean by querying the world graph directly?
     
  3. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,108
    "find all pathable or direct eyesight within range which have the following components"
     
  4. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    If you are looking for a single direction, then sphere cast is the way of doing things. If you are looking in all directions (again with a sphere), then you can do a CalculateDistance check and use an all hits collector.

    You can write your own custom collectors to filter out/accept hits the way you want.