OnTriggerEnter/Exit Not Called

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.

So much is going on here and you’re not mentioning some important aspects about your setup, like are you using kinematic rigidbodies and why do you force coordinates to some value in Update, it’s dangerous. Check you setup against the manual, show some pictures, list what components in what configurations you have or post example scene to look at. Right now it can be anything why the triggers won’t work as expected starting from erroneous configuration to exceeding the limits of builtin physics precision (fast moving bullets)

I used kinematic rigidbodies only at the last to check, I wasnt using them before.

Q. why do you force coordinates to some value in Update
Ans. This is a running game so I want to set left and right limit where the character can move so I have added checks if x position < 4 or x position > 10
then x position = maxLeftPosition or maxRight Position

If that’s the case and the rigidbody is non-kinematic, you should be adding forces, not update position. If you’re updating position, you should freeze the axis in rigidbody component that you’re setting yourself. If you don’t do it like that, then expect anomalies. I’m sorry if your setup is already verified to be good and I’m just babbling common knowledge.