- Home /
OnTriggerEnter/Exit not called sometimes
Hi, OnTriggerEnter/ OnTriggerExit is not being called sometimes. The scenario is that I have a rigidbody moving with rigidbody velocity. I am setting its y position to fixed such as
transform.position.y = 200;
in update function
I also change its transform.position.x and transform.position.z when it collides.
Static Triggers are placed on each corner to tell this rigidbody to move left or right.
But sometimes, ontriggerenter and ontriggerexit are not called.
Triggers are empty gameobjects with box colliders and isTrigger checked.
Just for checking I also added rigidbody and transform.Translate(0,0,0) in update of these static colliders but no improvement.
Rigidbody also has a box collider with isTrigger checked.
What can be the cause. Thanks? I have spent alot of time on it but could not find the solution.
Damn ! $$anonymous$$ost of the people don't format their code, but you format everything :)
The problem is tab at the beginning of a line - this is automatically treated as code, and formatted accordingly.
No answer? I also have the same kind of problem... In my case I don't really care if sometimes they are not called, but I care if they are not called in pairs( i.e. OnEnter followed by onExit). I miss one on of the events when I move the object fast through the triggers.
Your answer
Follow this Question
Related Questions
walk through an object once 0 Answers
Can someone please tell me why this code isn't working? 1 Answer
OnTriggerEnter function in c# 0 Answers
Make object react to certain triggers only 1 Answer
OntriggerEnter / Stay with the same Gameobject tags 0 Answers