A few people seem to have had this issue also but I haven’t yet found a correct response to it yet.
I have followed the FPS tutorial, there were no problems. I have also set up a fresh project utilising just the Robot artwork folder and the AI, AI Animation, and Autowaypoint script from the tutorial and this also worked fine.
However when trying to use these scripts in my own project, still with the standard Robot, the Robot does not recognize my player character. This is the case regardless of whether I let the Robot locate it via the tag reference or drop the character prefab into the exposed variable.
If i de-tag my player character, and instead tag a box, or something else as ‘Player’ it DOES work though and starts shooting at it.
My player character is basically my own version of Lerpz from the 3D platform game, and except for being imported at a smaller scale than the robot seems pretty standard.
Can anyone let me know whats going on here please?
Right after fiddling with this some more, the robot will shoot the player character when tagged ‘Player’. But only if I move the character controllers center lower than it should be so that when the game starts he is walking through the air. I am very confused.
Any explanations?
OK, the issue lies with the LineCast part of the CanSeeTarget function in the AI script. Basically your doing a raytrace to see if anything is in between the player and the enemy, and in my situation I am always intersecting with the ground first.
So now I need to know why the linecast is being sent from the feet of the enemy to the feet of the player and not between their pivot points. Or to be more precise the transform gizmo is shown in the editor to me in their centers which would work fine, however the transform coordinates in the inspector state the pivot is at y = 0, ground level.
In the FPS tutorial the trace is sent from the center of the enemies so that it works correctly.
Why does the gizmo and inspector pivot point not match up, and how do I alter the pivot point so that they do? Thanks for any help.