- Home /
How do I make a sphere "know" when the player is nearby?
if it says "The question is waiting approval by a moderator" why do you post it again?
Have you tried googl'ing for this? You'll find something about this for sure
Answer by Dothackking · Jul 16, 2013 at 09:31 PM
void OnTriggerStay(collider col)
{
if col.tag == "player"
{
Debug.log("A PLAYER IS NEAR!")
}
}
OnTriggerStay is called every time the object moves inside of the trigger(It works funny, look up my questions to find a fix for a non-moving player), collider col is the collider of the object inside of the sphere's trigger. col.tag is the tag on the object the collider is attached to, which, most likely will be player. Debug.log is simply for showing that it works.
Your answer
Follow this Question
Related Questions
Having trouble finding a direction up and down a sphere 2 Answers
Nav Mesh Agent not smooth 1 Answer
Rigidbody.AddForce and incorrect rotation 2 Answers
Controlling a sphere object 1 Answer
Camera limitation depending on gravity around sphere 1 Answer