- Home /
How to use proximity detector to detect objects coming closer using C# script
I want to detect if something is coming closer and I want to get its distance and name.
Answer by Raresh · Jun 01, 2016 at 06:21 PM
I won't post the explicit code, but this is how you could do it:
1) Have a sphere/box whatever trigger, that trigger would detect objects in a certain radius of your object.
2) Have a list/array/dictionary of the GameObjects in that trigger.
3) Whenever a new object enters the trigger, add it to that list.
4) Have a dictionary that stores the distance from the previous frame from the player.
5) Compare the 2 distances.
Thanks, I understood what you said. But I am not following everything exactly.
Your answer
Follow this Question
Related Questions
how to identify near objects 1 Answer
Detect if an object is next to another? 0 Answers
Player Proximity Detection 1 Answer
having trouble with sight detection 2 Answers
How to create an aura with selective collision detection 2 Answers