I have a problem. I want isOffRoad to become true whenever the wheel enters a collider attached to an object with a tag offRoadBorder, and for it to become false upon exiting it. Nothing seems to work. Both collider and the wheel have rigidbody2D attached. Thanks in advance.
public bool isOffRoad = false;
void OnTriggerEnter2D(Collider2D col)
{
Debug.Log("a");
if (col.tag == "offRoadBorder")
{
isOffRoad = true;
}
}
void OnTriggerExit2D(Collider2D col)
{
Debug.Log("b");
if (col.tag == "offRoadBorder")
{
isOffRoad = false;
}
}
