Can you make a one sided trigger? I have a game with a bicycle that runs on the road and I want to make a notification when the player cycles to far to the left on the road. This also needs to work for both directions of the player. Thats why I need a trigger that only triggers if you enter the trigger from the left.
This is not foolproof, but it should work for most occasions:
private void OnTriggerEnter(Collider c)
{
//convert the playerposition into localposition for the trigger
Vector3 localPosition = transform.InverseTransformPoint(c.transform.position);
if(localPosition.x > 0)
{
//Player is on the left
}
}
This assumes that the player has a centered collider.