- Home /
Camera Auto-Align with the nearest object with a determinated tag
Hey guys
I was writing a source, but unfortunately I can't get any logic to write a source to align the camera with the nearest object with a determinated tag, if it is near to the center of the screen.
I try to explain this better:
I have a camera moving and rotating.
I want that if it founds a particular gameobject that is near to the camera and has a particular tag, it will aligned to it, and it remains untill, another gameobject doesn't take its position or it will destroyed.
How can I explan to Unity?
I tried with Camera.main.ScreenToWorldPoint ();
This is the logic:
if the object has the setted tag (example enemy) then (simple, i can do this)
if the object is the nearest then (simple I can do this)
if the object is near to the center of the screen then (here is the problem) align the camera to the object.
I don't know how to detect, if the object is near to the center of the screen. But i don't know how to detect if the gameobject is near of the center of screen
Please help
Thanks byeeee!
I have to check from screen space to world, i mean that the object is near to the center of screen, is selected, and camera will align to it!!!
Try explaining it, as if I was a little child. I cannot understand you, I'm sorry..
@alucardj ooops, thanks for the heads up, wasn't on purpose..
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Camera Auto-Align with the nearest object with a determinated tag 0 Answers
Why is my camera switching angles? 0 Answers
Editing the standard FPS to work different 0 Answers
How would I get camera bobbing? 0 Answers