Search Unity

Perfectly overlapping colliders result in only one of them being detected by Unity.Physics raycasts

Discussion in 'Entity Component System' started by Abbrew, May 24, 2019.

  1. Abbrew

    Abbrew

    Joined:
    Jan 1, 2018
    Posts:
    417
    Is this normal behavior? I even have one collider as one layer, and another as another layer, and set up the raycast to detect only the first layer. In addition, I went to Edit->Project Settings-> Physics and unchecked the boxes so that each layer can only collide with itself (the raycast input's layer will be, for example, set to A when the collider it wants to detect is in layer A).

    Edit: It appears that the problem is that if a GO with a collider and layer A is a child of another GO with a collider and layer B, only the parent GO with layer B will be detected by raycasts. The parent GO in this case has the ConvertToEntity script attached to it whereas the child does not. Any insight into this weird behavior?

    Edit2: Fixed by changing ConvertAndInject to ConvertAndDestroy. Forgot that I have to do ConvertAndInject if I want children to be converted as well. Mods please remove if this post is non-informative
     
    Last edited: May 24, 2019