Not being detected by Can See Object?

Akairem

New member
Hey guys, I'm having an issue where the mentioned task just always seems to fail? Even when I run my character directly in front of the AI. It just fails

I have attached four images just to show anything that may be relevant to the issue as I'm genuinely not sure where I am going wrong.

One other question I also had regarding this is, how would we use this for detecting other objects aside from the player?

For example, I have a different faction of AI I want to use, so ideally, this will mean they have to see the player as well as any number of the other characters belonging to that faction, and since we can only add one Target Tag, I'm not sure how I'd go about this?
 

Attachments

  • 3c47c473bfd4a5dc0e955e0de97cc1ac.png
    3c47c473bfd4a5dc0e955e0de97cc1ac.png
    48.7 KB · Views: 2
  • 851a6444584c4a03398a89245f18e7ad.png
    851a6444584c4a03398a89245f18e7ad.png
    29.4 KB · Views: 2
  • 625666ee1fdd7908def1bb3d0d5a7e09.png
    625666ee1fdd7908def1bb3d0d5a7e09.png
    75.9 KB · Views: 2
  • de7aa210cbfc9bd4f596954086baf95e.png
    de7aa210cbfc9bd4f596954086baf95e.png
    83.5 KB · Views: 2
Take a look at this page for debugging tips with can see:


For example, I have a different faction of AI I want to use, so ideally, this will mean they have to see the player as well as any number of the other characters belonging to that faction, and since we can only add one Target Tag, I'm not sure how I'd go about this?
You can change the Detection Mode to specify the type of detection that you want to do. In your case I'd use the list option and use a SharedGameObjectList to specify which objects you want to use:

 
Take a look at this page for debugging tips with can see:



You can change the Detection Mode to specify the type of detection that you want to do. In your case I'd use the list option and use a SharedGameObjectList to specify which objects you want to use:

Thanks so much for the reply. My first problem has more or less been fixed, so now I am being detected properly. The only thing remaining with this is, I cannot consistently be detected behind cover.

I have played with the offsets a lot now, but it seems that I am unable to make it work adequately.
I have a number of blocks in the scene that I have tested with so for instance, if I stand behind a knee height block, it is fine. If I stand behind a chest high block so that the head is still visible, it is no longer detectable.

So I adjust the offset so that he is detectable, but I then see that I can now stand directly in the open and crouch, and am no longer detectable again. I'm not too sure how to go about fixing this?

In regards to the second problem. I've read through it, but I'm not sure I quite follow it?

I edited the script CanSeeObject and added the line
public SharedGameObjectList sharedGameObjectList as you suggested

But if I then go into the designer variable tab as it mentions, I choose Type GameObjectList band create a variable there too. But I still don't have a GameObject to assign to this variable as the object doesn't exist yet until they spawn.

I imagine I'm being incredibly stupid, so sorry about that. I'm guessing I am just missing some steps of guidance in that post.
 
Last edited:
I edited the script CanSeeObject and added the line
public SharedGameObjectList sharedGameObjectList as you suggested
No, you shouldn't edit CanSeeObject. You instead want to create a new SharedGameObjectList from the Variables tab and assign that variable to the Target Objects field. The second image from the variable documentation shows how to do that.
 
No, you shouldn't edit CanSeeObject. You instead want to create a new SharedGameObjectList from the Variables tab and assign that variable to the Target Objects field. The second image from the variable documentation shows how to do that.
Thanks for the reply again!

In regards to what I mentioned above, any ideas as to how I can fix the issue of not being consistently detected?
The offset just always results in me being detected when crouching but not standing or a vice versa kind of situation
 
If you enable the debug line you should be able to determine why it's being detected for one but not the other. My guess is that you will need to adjust the offset/target offset field so the raycast hits the collider.
 
Back
Top