I would gladly use help from the forums at this point as I can’t get this issue fixed by myself.
My enemy AI is programmed to chase, patrol and shoot depending on if they see the player. If they don’t they patrol between waypoints if they do they chase him AND this is the part I can’t fix If they are in the range of the player they should theoretically shoot him. (shoot meaning using Raycast)
Now Patrol and Chase work 100% but this doesn’t… The only debug that shows up when in game is the first one (“DA ENEMY SHOT BREH BREH”) which is outside of the if statement. Any help appreciated!
Cheers!
Here is the piece of script that is related to the shooting:
You can put that before the if statement to see in the editor where it’s raycasting up to exactly. If it’s missing you know it’s facing the wrong way, if it’s hitting and still not calling you need to check the layers that the objects are on, or make sure there’s nothing invisible in between them.
Ok sweet It did help me and noticed that the raycast shoots from below the plane… So I added this little beauty
Debug.DrawRay(transform.position, transform.forward * range);
if (Physics.Raycast(transform.position + shootPointOffset, transform.forward, out hit, range))
and raised the Y offset. Although the enemy does now hit the player and kills him. The raycast still shows coming from his feet or below his feet (hard to tell). Is that normal?