• Opsive has been nominated for TWO Unity Awards: Publisher of the Year and Best Development Tool (Behavior Designer Pro)! Your support means everything, cast your vote here: https://awards.unity.com/vote

Line of sight not working?

HCWE

New member
Hi
I am using BD Pro (I have the same problem in the original BD) and i cant get the line of sight or "Can see object" task to work.
I have tried to set the ignore layer mask both to none and all but i still cant see the target. However if i turn off "Line Of Sight" on the WithinDistance node then i can "see" my target.

I have used the debug ray and the ray turns yellow, so it thinks something is in the way but since it turns yellow no matter what my ignore layer mask is something feels off.

Anyone that have ran into the same problem and know why it is happening and of a way to fix it?
 
Are you using Behavior Designer or Behavior Designer Pro? For Behavior Designer Pro the Can See Object task is a sample task that contains a very limited line of sight check, and there is no Line of Sight check with the sample Within Distance task. This makes me think you are using the original Behavior Designer tasks.

If the debug line is turning yellow there is an obstructing object. Try changing the offset or the target offset, maybe the raycast is hitting the floor.
 
I am using Behavior Designer Pro, but i moved over the function of WithinDistance.cs and MovementUtility.cs from the original BD to pro.
Changed the enum for bools since the new SharedVariable<T> did not handle flags and i lost the debug gizmos but the script seems to work.

It seems like it was a me problem, as i mentioned in the post i tested the ignore layers to be "All" or "None" in the case of "All" i also ignored the layer of the object i wanted to see, and in the case of "None" it seems like i picked up the floor / my own collider?

If others have the same issue:
Did as suggested and moved the position up by .5 on the Y and set the "Disable Agent Collider Layer" to true, and only had "Ignore Raycast" as Ignore layer. And that fixed the problem.
 
Back
Top