Issues with collisions between triggers

Hello.

I have a VR project where in which the user can potentially collide with a car as well as other cars can collide with each other. What I want to have happen is that when a car collides either with another car or the vr user, the car will stop, then after a short delay of 2 seconds resume the path it takes. Equally there are traffic lights the car will stop at if it’s red and then resume it’s path if it is green.

The code I have for both is outlined below:
For traffic lights:
public GameObject red;
public GameObject green;
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == “Car”)
{
CarController c = other.gameObject.GetComponent();
if (red.active == true)
{
c.carSound.Pause();
c.rb.constraints = RigidbodyConstraints.FreezePosition;
}
}
}
void OnTriggerStay(Collider other)
{
CarController c = other.gameObject.GetComponent();
if (red.active == true)
{
c.carSound.Pause();
c.rb.constraints = RigidbodyConstraints.FreezePosition;
}
if (green.active == true)
{
c.carSound.Play();
c.rb.constraints = RigidbodyConstraints.None;
c.rb.constraints = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;
}
}
This code will be applied to each traffic light and essentially tell the car to stop moving when red and continue to stop moving as it is within the trigger. When green, the car can move again.
For car and other triggers:
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == “Light”) return;
else
{
carSound.Pause();
rb.constraints = RigidbodyConstraints.FreezePosition;
}
}
void OnTriggerStay(Collider other)
{
if (other.gameObject.tag == “Light”) return;
else
{
Debug.Log(other.gameObject.name);
colliderDelay = 2.0f;
}
}
void OnTriggerExit(Collider other)
{
if (other.gameObject.tag == “Light”) return;
else
{
Invoke(“moveAgain”, colliderDelay);
}
}
void moveAgain()
{
carSound.Play();
rb.constraints = RigidbodyConstraints.None;
rb.constraints = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;
}
This does something similiar, but I do not want the car collider to notice the light collider. For all other colliders I want to pause the car when colliding, use ontriggerstay to ensure that while it is colliding the delay to move again will be two second, and when exiting the collision the car will move again after the specified delay.

My current problem is that the car is sometimes ignoring the player collider and phasing through it, as well as ignoring the other car colliders leading to it the cars being merged. Is there a clearer way to do this?

Please format your code correctly.
Code is formatted by surrounding it with 3 backticks, and color coded as C# with cs or csharp:

```csharp
// Your code here
```

If the car is sometimes passing through the collider, then try switching it to continuous collision detection.