Hellwalker
New member
Hello, I'm using Movement Pack and WithinDistance code. And I want to use line of sight function.
I'm having trouble understanding how it's supposed to work.
In code on line 97 we have:
Code (CSharp):
And particularly the "if (hitTransform != null)" returns true if basically anything blocked LOS. It does not check if the returned transform is actually the target transform. So in my case Enemy Collider or a Wall can return positive on LOS.
Is this a bug, or am I doing something wrong with my setup?
For ignoreLayerMask I understood I should place here the object layers I don't want to be checked for LOS.
I'm having trouble understanding how it's supposed to work.
In code on line 97 we have:
Code (CSharp):
- if (lineOfSight.Value) {
- var hitTransform = MovementUtility.LineOfSight(transform, offset.Value, objects, targetOffset.Value, usePhysics2D, ignoreLayerMask.value, drawDebugRay.Value);
[*] if (hitTransform != null) {
[*] // the object has a magnitude less than the specified magnitude and is within sight. Set the object and return success
[*] returnedObject.Value = objects;
[*] return TaskStatus.Success;
[*] }
And particularly the "if (hitTransform != null)" returns true if basically anything blocked LOS. It does not check if the returned transform is actually the target transform. So in my case Enemy Collider or a Wall can return positive on LOS.
Is this a bug, or am I doing something wrong with my setup?
For ignoreLayerMask I understood I should place here the object layers I don't want to be checked for LOS.