Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Problem with Raycasts starting in colliders

Discussion in 'Editor & General Support' started by iso250, Nov 22, 2015.

  1. iso250

    iso250

    Joined:
    Apr 19, 2015
    Posts:
    28
    Hello all.

    In the game I'm making the enemies are able to use various buffs, such as healing pulses, on themselves and any other enemies that they have line of sight to. For various reason I need "Raycasts Start in Colliders" to be on and for the enemies to be on the same layer. This has the effect of preventing the line of sight raycasts from exiting the trigger/collider of the enemy that is emitting the buff.

    I know I could temporarily move the enemy off the layer until the raycasting is done and then move it back on to the layer it's meant to be, but I fear that this could cause issues if other enemies are also trying to buff itself and its allies at the same time. (The buffs are not instantaneous. Some of them are gradual and take time.)

    Is there any way to make a raycast exit the trigger/colllider it's emanating from whilst keeping the enemy on the layer it's meant to be whilst keeping "Raycasts Start in Colliders" activated? I've look for an answer to this but haven't been able to find one.
     
  2. iso250

    iso250

    Joined:
    Apr 19, 2015
    Posts:
    28
    Nobody has any idea about this?