So when we have object inside of the field, object can’t go out from the field (For that i use BoxColidier2D). But when object coming from the outside of field, it can enter to the field
Thank you!![![alt text][2]][3]
You can set the bottom collider as trigger, this let the obect pass, and with a simple script you can activate it when the object pass through, something like this:
void OnTriggerEnter2D(Collider2D other) {
if(other.tag == "ObjectTagHere"){
GetComponent<Collider2D>().isTrigger = false;
}
}
or
void OnTriggerExit2D(Collider2D other) {
if(other.tag == "ObjectTagHere"){
GetComponent<Collider2D>().isTrigger = false;
}
}
Not working :/ Do i need to check "Is trigger" or no?
– VimLoudyYes, you need to set as trigger the collider in the inspector by checking isTrigger, and put this script on that gameobject
– AmunTechCollider of my object or Collider of field? And i did BoxCollider2D
– VimLoudyCollider of field, the collider of the object where your object need to pass through. And sorry i forgot you are using 2D so i edited the above code.
– AmunTech