So I have tried the following as suggested on another thread.
void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "theobjectToIgnore")
{
Physics.IgnoreCollision(theobjectToIgnore.collider, collider);
}
I'm trying to push a ball through a barrier, the ball is supposed to go through but not the character. The object is named Ball and the tag is also named Ball. So my script is as follows:
void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "Ball")
{
Physics.IgnoreCollision(**Ball**.collider, collider);
}
}
the second ball though is red and it is not being detected via typing... can anyone help me?
↧