- Home /
Detect radius from object
Hey guys,
I want my character to be able to interact with objects via right clicking when within a certain radius of that object, how can I have the game read the characters distance from the object?
Thanks,
JPiiONEFOURONE
Answer by Berenger · Jun 21, 2012 at 04:09 PM
You can use the function OnTriggerEnter, either on the character or the clickable object. Or you can call Physics.OverlapSphere to check if it close enough. Or you can detect the click, check the distance and then do something if the dist is correct.
Your answer
Follow this Question
Related Questions
how to get objects that are in some radius with the point in certain center 1 Answer
Pathfinding objects being forced to be far away from one and another 1 Answer
Detect collision with specified object 1 Answer
detecting whether the object has been clicked in another script 2 Answers
OnMouseUp() Update? Movement. 1 Answer