OnTriggerEnter called while it should not

Hi, i’ve go a problem with a trigger and can’t find any explanation about it

40352-trigger.png

so as you can see there is a sphere, some walls and a trigger which is thiner than the walls. The problem is that when the ball is against the wall, sometimes it calls OnTriggerEnter which is not wanted…

Try reducing the Collider size of the Sphere, and if you are using a Script, post it, dont know if something is triggered from it.

In your trigger script in the OnTriggerEnter function you are not checking if the entering gameobject is the ball.Tag the ball as player . Try this .

public GameObject ball ;
void Start () {
ball = GameObject.FindGameObjectWithTag("player");
}
void OnTriggerEnter(Collider other){
    if(other.gameObject.tag == "player")
{
  // your code here
}
}

This works . The thing is you are not checking if the colliding gameobject is the ball . Thus it may cause error for the collider of other nearby wall will be in the trigger of this wall . Thus to prevent unnecessary collision detection use the parameter Collider
as I have done .

Do tell for further help.