'Issues detecting actors in player's FOV
I'm working on a school project with a few other people. We are creating a game where the main focus is taking pictures of animals. It is similar to Pokemon Snap but open world and somewhat educational. My job is to make the in-game picture camera that takes pictures of the animals. To be clear I am going to refer to this as the picture camera, I will refer to the first-person player camera as the player camera, and the scene capture component as the scene capture component. Hopefully, that keeps the camera confusion down.
I have a somewhat functional system that works for the most part, however, sometimes it picks up actors outside of the FOV (check the second in-game screenshot below). I think the problem is that the viewport is drawn to the max FOV of 170 degrees. So for example, if you're playing at 90 degrees and there's an actor at about 75 degrees from the center of the screen, it is picked up as being on screen despite being out of the player's view.
I'm not sure how to fix this, I tried making some calculations with the max FOV(170) and the player's FOV, yet, no luck with that. If anyone knows how to fix this it'd be very greatly appreciated.
Code to determine actors in the player's view
Working properly (One zebra can be seen in the picture and the game prints out that there is only one zebra
Not working properly (One zebra can be seen in the picture and the game prints out that there are multiple zebras)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
