Field of view using secondary camera projection
Hi there, I'm wondering if it's possible to show what a secondary camera sees on to the primary camera. I am making a twin-stick shooter-type game with a bird's-eye, over the shoulder camera that follows the player's character.
The main mechanic of the game is to allow the player to only see enemies within his character's line of sight relative to the character's point of view. I followed this tutorial and it got close, though it's only on a 2D plane and it relies on the position of the camera, rather than the position of the player.
I would like to be able to use a second camera and possibly shaders to achieve what I'm looking for, but I'm jut not sure about what to research or where to go.
Below is an example of the assets I'm using and what I'm trying to accomplish. Each slide is a view on the left of pretty much what the actual character would see. You can see the white target is obscured by the jeep in front of it. The right side is what the player would see while they're playing. a 3/4 bird's eye camera that follows their character.
- Slide 1 shows how it currently plays, where the player would see the entire target because this hasn't been accomplished yet.
- Slide 2 shows the outline projected onto the target to show what I would want to be removed from the slide on the right side, so the player would not be able to see it
- Slide 3 would be the final result. The character can only see that much of the target, so the player is then shown exactly what the character can see.
There is a great example of a bit of projection at this github link, though that code does not go as far as to put something behind those obstacles and use the "shadow" do to what I'm thinking.
Does anyone have any thoughts as to where I can start? Is this a shader? A camera setting? something else?
Thank you!
Your answer
Follow this Question
Related Questions
Resizing camera based on device 0 Answers
Looking at a Chunk from Straight Down will not Render Blocks, but Looking at it from the Side does? 1 Answer
Get real colors like white or black 1 Answer
2D Mobile: How to mask a gameObject with another gameObject (with soft edges) 0 Answers
Is there a shader I could use to always render a material over another material? 0 Answers