Search Unity

Feedback Physics and ColliderDistanceInput with Filter Override

Discussion in 'DOTS Dev Blitz Day 2022 - Q&A' started by Kmsxkuse, Dec 7, 2022.

  1. Kmsxkuse

    Kmsxkuse

    Joined:
    Feb 15, 2019
    Posts:
    306
    Another request for the dots physics team. Please add an option in the ColliderDistanceInput struct for a filter override of the collider blob being calculated.

    Currently, I am cloning the source collider then editing the filter of that collider before using it as the input of the calculate distance method. Then disposing of it once the calculation is complete.
     
  2. daniel-holz

    daniel-holz

    Unity Technologies

    Joined:
    Sep 17, 2021
    Posts:
    278
    To confirm my understanding, in your case there is a collision filter on the collider you are using in ColliderDistanceInput and you would like it to be ignored in the distance query. Is that correct?
     
    Kmsxkuse likes this.
  3. Kmsxkuse

    Kmsxkuse

    Joined:
    Feb 15, 2019
    Posts:
    306
    Yes and I would like an option to override the filter of the collider being used in the CDI.

    One situation I have right now is on a player entity, I need to find all colliders of a specific layer around it in a certain radius. But the collider itself can collide with everything. If I were to use the player's collider as the input as-is, it'll return a lot of junk collider hits that I will then need to filter out in an additional step.

    So right now I'm cloning the player collider and setting the filter to the layer I want and using the cloned collier as the input.

    I would like an option to skip the cloning and simply override the filter of the original collider for this specific collider distance input query.
     
    Last edited: Dec 15, 2022
    daniel-holz likes this.
  4. daniel-holz

    daniel-holz

    Unity Technologies

    Joined:
    Sep 17, 2021
    Posts:
    278
    That makes a lot of sense. I've relayed your feature request internally.
     
    Kmsxkuse likes this.