Below is my code. the problem i’m having is that the triggers sometimes don’t happen.
void OnTriggerEnter2D(Collider2D col)
{
print("trig hit!" + col.gameObject.name);
switch(col.gameObject.name)
{
case "LeftImage":
print("Left Image Hit!");
//UnityEngine.Physics.gravity = new Vector3(-10,0,0);
Physics2D.gravity = new Vector3(-80f,0f,0f);
break;
case "RightImage":
print("Right Image Hit!");
//UnityEngine.Physics.gravity = new Vector3(-10,0,0);
Physics2D.gravity = new Vector3(80f,0f,0f);
break;
case "TopImage":
print("Top Image Hit!");
//UnityEngine.Physics.gravity = new Vector3(-10,0,0);
Physics2D.gravity = new Vector3(0f,80f,0f);
break;
case "BottomImage":
print("Bottom Image Hit!");
//UnityEngine.Physics.gravity = new Vector3(-10,0,0);
Physics2D.gravity = new Vector3(0f,-80f,0f);
break;
}
}