- Home /
Question by
Cervelx · Sep 05, 2016 at 04:18 AM ·
ontriggerstay
Problem with OnTriggerStay()...
I have a problem with the OnTriggerStay() this is a piece of my simple player controller:
void OnTriggerStay(Collider other)
{
if (other.gameObject.CompareTag ("Acceleration"))
{
TAcceleration = 4;
}
}
The problem is that: When i go out from the collider the Tacceleration is yet 4! And not 1 :/
Please Help me
Comment
Answer by JedBeryll · Sep 05, 2016 at 06:00 AM
Add another function:
void OnTriggerExit()
{
if (other.gameObject.CompareTag ("Acceleration"))
{
TAcceleration = 1;
}
}
Your answer
Follow this Question
Related Questions
OnTriggerEnter only working once. 0 Answers
Detect gameObjects within range and assign them as movetarget 1 Answer
Can't catch event of the pressing the button 1 Answer
Change cursor on OnTrigger 0 Answers
Work around for onTriggerStay? 1 Answer