- Home /
how do i make it so an object only moves towards the player if its in the camera frame?
so im making game and i will add missiles that will be randomly generated as the game progresses and i was wondering how can i make it so the missiles move towards the player ONLY if they are in the camera frame. any help would be appreciated and please feel free to ask me for more details.,So im making a game and i will add missiles that will be generated as the game progresses and i want the missiles to only move towards the player if they are in the camera frame. Any help would be appreciated and please feel free to ask me for more details.
Answer by swanne · Nov 04, 2021 at 03:03 PM
How about using a collider configured as a trigger? Set it as a child of the camera so it always moves and stays frame size. Then encapsulate your move towards player code on the missile under a OnTriggerEnter() function?
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
[Compute Shader] Pixel Data from Texture Coordinates 0 Answers
How can i get current camera's background color? 1 Answer
Call Update once per object vs Update all in a central script 2 Answers
Trying to disable the Script below on trigger or the closest thing 0 Answers