- Home /
Question by
danielmetlitski · Jan 11, 2015 at 10:37 AM ·
triggercollider2dboxcollider2distrigger
Turning off trigger with multiple box colliders?
Hey guys, my gameObject has multiple 2d colliders, one of which has a trigger. My problem is that myTransform.collider2D.isTrigger returns false even though there is a trigger on one of the collider2D's, so I can't turn it off since it's already off. Any clue how I could fix this? Thanks in advance!
Comment
void OnCollisionStay2D(Collision2D collision)
{
if (collision.collider.gameObject.CompareTag("Platform"))
{
Grounded = true;
if (!myTransform.collider2D.isTrigger) //if its a trigger and it hit the plaform
{
myTransform.collider2D.isTrigger = false; //stop if from being a trigger
Debug.Log("Trigger was deleted");
}
}
}
if (!myTransform.collider2D.isTrigger) //if its a trigger and it hit the plaform
{
myTransform.collider2D.isTrigger = false; //stop if from being a trigger
I am new to scripting but doesn't this mean basically if isTrigger is false then make isTrigger false?
That is correct. I am trying to make it false, but the problem is that it is false in the first place, when clearly the collider2d has the is trigger thingy checked!