- Home /
Question by
Rphysx · Apr 22, 2014 at 01:13 PM ·
c#boxcollider2dcontacts
other.Contacts[0].normal.y Not Recognised
OnCollisionEnter2D has this nice property which tells you where the object collided based on normal.x or normal.y results (which both ranges from -1.62andother500numbers and +1.62andother500numbers) but apparently if I wrote an if statement like this one :
if (other.contacts[0].normal.y > 1.6) { MyBeautifulBoolean = false; }
the above won't execute if normal.y is 1.62etcetc. Anybody knows why ?
Comment
It might be worth separating this logic out, e.g.
float value = other.contacts[0].normal.y;
if (value > 1.6f)
{
$$anonymous$$yBeautifulBoolean = false;
Debug.Log("The if statement was true");
}
else
{
Debug.Log("The if statement was false");
}
Then use the debugger to figure out what's going on.