grimreper10977
New member
Hello,
I'm trying to use the Can See Object task to make a 2D enemy turn around when it "Sees" a wall like object. I have attached an image showing the FOV view cone and the Can See Object settings. If anyone would like a video of the problem in action I can also post a video as further clarification. However, I'll describe the issue below for now. The greyed out branch is disabled and is how I got this to work without the Can See Object, so it can be ignored for this question.
As can be seen in the image, the can see object is set to use 2d physics and I've modified the FOV angle to be 180 degrees so that presumably the enemy will be able to see objects on either side of it. I've set the initial velocity to -5 so the enemy moves to the left. My intention is that the tooth on the left will come into view, and the velocity variable will be multiplied by -1 and set as the new gameobject veolocy thus moving it to the right. This DOES work for the tooth on the left. However when the enemy reaches the tooth on the right, it does not flip. It just collides and keeps trying to move to the right. It also does not work when I set the initial velocity to be 5 (so it starts moving towards the right) so it has nothing to do with the second flip failing for some reason, it's an issue with "seeing" an object on the right. Additionally, I've tried then moving the enemy to the left of the left tooth which had previously worked, yet that still does not cause it change direction. The Can See Object task never becomes successful when the enemy is moving to the right, UNLESS I also move the cone to the right using the x offset. When I do this, the enemy does flip and bounces back and forth between the two teeth. It seems to me as if somehow only the left side of the FOV cone is registering as "seeing" and what the cone seems to overlap is not correlated to what is being registered as seen.
Based on the settings I have shown in the image, should the Can See Object be able to "see" objects on either side of this enemy?
Has anyone else experienced the view cone not seem to be accurately representing what the Can See Object task is "seeing"?
Am I missing something obvious?
Any help is appreciated as I've spent the last few hours playing with this trying to make it work. I haven't had any luck searching online for an answer. All the videos I've seen of this task seem to work exactly as I expected, but these are all in 3d games, while this is 2D. If anyone needs any further explanation/information or a video of the issue I will be happy to provide.
Thanks.
I'm trying to use the Can See Object task to make a 2D enemy turn around when it "Sees" a wall like object. I have attached an image showing the FOV view cone and the Can See Object settings. If anyone would like a video of the problem in action I can also post a video as further clarification. However, I'll describe the issue below for now. The greyed out branch is disabled and is how I got this to work without the Can See Object, so it can be ignored for this question.
As can be seen in the image, the can see object is set to use 2d physics and I've modified the FOV angle to be 180 degrees so that presumably the enemy will be able to see objects on either side of it. I've set the initial velocity to -5 so the enemy moves to the left. My intention is that the tooth on the left will come into view, and the velocity variable will be multiplied by -1 and set as the new gameobject veolocy thus moving it to the right. This DOES work for the tooth on the left. However when the enemy reaches the tooth on the right, it does not flip. It just collides and keeps trying to move to the right. It also does not work when I set the initial velocity to be 5 (so it starts moving towards the right) so it has nothing to do with the second flip failing for some reason, it's an issue with "seeing" an object on the right. Additionally, I've tried then moving the enemy to the left of the left tooth which had previously worked, yet that still does not cause it change direction. The Can See Object task never becomes successful when the enemy is moving to the right, UNLESS I also move the cone to the right using the x offset. When I do this, the enemy does flip and bounces back and forth between the two teeth. It seems to me as if somehow only the left side of the FOV cone is registering as "seeing" and what the cone seems to overlap is not correlated to what is being registered as seen.
Based on the settings I have shown in the image, should the Can See Object be able to "see" objects on either side of this enemy?
Has anyone else experienced the view cone not seem to be accurately representing what the Can See Object task is "seeing"?
Am I missing something obvious?
Any help is appreciated as I've spent the last few hours playing with this trying to make it work. I haven't had any luck searching online for an answer. All the videos I've seen of this task seem to work exactly as I expected, but these are all in 3d games, while this is 2D. If anyone needs any further explanation/information or a video of the issue I will be happy to provide.
Thanks.