Can See Object not working

starfoxy

New member
Loving this asset and having an early issue. I tried searching the forum but couldn't find anything specific to this. I have everything set up as per this video:


It all seems to work *but* my Can See Object just isn't ever returning true. I am working with 2D. I have selected Use Physics 2D. My 'vision cone' shows properly and I can adjust it.

I guess my first hunch is that tutorial says to drag a Transform (to use as the Target Object) but when I drag it into that field it is a GameObject which means I can't assign the Transform variable to the returned object on Can See Object or the Target on the Seek task as it's a Transform and not a GameObject.

Does this all make sense? Ok. So then, I decided I would make that variable a GameObject and then I was able to select it for the returned object on Can See Object and also as the Target on the Seek task. It still did not work - even when I placed my player object directly in the 'vision cone' it wouldn't return true.

**edit**

Ok I have compared to a past project that I have done and the other project worked fine when using a GameObject variable in place of a Transform so it must be something else.

:unsure:

Does anyone have any ideas?
 
Last edited:
The tutorial video uses the tasks in the description of the video which are a bit different from the Movement Pack tasks. The Movement Pack tasks contain a lot more functionality compared to the tutorial tasks, and they also use a GameObject instead of Transform.

On the Can See Object task you can enable debugging and this will draw a line which indicates the status. This page gives a description of the status which should help point you to what is going wrong: https://opsive.com/support/documentation/behavior-designer-movement-pack/
 
Thanks for your assistance. I had enabled debugging for the raycast and was getting a yellow line which says there is an obstacle. Really weird as there is no obstacle between the two GameObjects. Any ideas what may cause that?

**update**

After rebuilding everything from scratch I tested with just a seek behavior moving towards the player gameobject. That works fine.

I then added the sequence and can see object and turned on debug raycast. There is no line at all. Super weird. Testing further.

**update2**

If I add a selector right after the entry point with another seek to the right as per the video, the raycast debugging shows up. What in the heck? Shouldn't raycast debugging always be visible for the can see object?

**update3**

Raycast debugger shows proper colors ie. red, magent, yellow and is showing a yellow line when in field of view even though there are no obstacles/anything blocking (that I can see) in the way.

Are there any insights for this situation? What could be giving a vibe of being an obstacle?

**update4 and (partial) SOLUTION!**

To help anyone else who may have the same issue as I was having... I searched for the word 'yellow' and came across this thread:

https://www.opsive.com/forum/index.php?threads/how-to-assign-variables.3200/#post-15952

Upon reading that, I realized my 'sight cone' was being blocked by the object itself that it was attached to. Adjusting the offset in the can see object task fixed it and now my debug raycast is a green line to the other object. Yay!

But now comes the next question. What if I want a 360 2D field of view and cannot use that offset as it really only helps in 1 direction? Is there some way I can mask my object from being hit by its own raycast but still able to 'see' the other object?

**SOLVED**

For anyone else, I created a new layer and assigned my seeker object to it. Then I changed Ignore Layer Mask in the can see object task to the name of my new layer. Voila. It doesn't interfere with itself anymore.
 
Last edited:
I am back and it's only 4 years later! I figured it makes sense to reuse this thread for others as I have another issue with can see object. I am using the same setup as the youtube video here:


On the video (the one with idle), the can see object task has an X with a circle around it which was mentioned by the presenter. On my tree (the one with patrol), I have no circle (just an X) and figure that may give me some clue as to what is incorrect with my implementation.

I have tried previous solutions mentioned here and can't seem to get it to 'see' anything. Any ideas as to what may be happening?

mine.JPGtutorial.JPG

Update:

I got this working! For anyone else with the same issue, I had to set my sequence abort type to both. Voila!

Another question:

My can see object works and the seek executes. However, once the seek is complete (it catches up to the target), it goes back to patrol.

How would I go about making the seek continuous once can see object is true rather than immediately reverting back to patrol?

ie. continue to seek the object once can see object is true.

Solved: setting Sequence abort type to lower priority solved this.
 
Last edited:
Back
Top