Question by
EvilPandaMan · Jan 22, 2018 at 06:09 PM ·
collisioncolliderignorecollision
Object ignore collider with another - Please Help
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?
Comment
Your answer
Follow this Question
Related Questions
Navmesh agents not colliding with non trigger colliders? 0 Answers
Why won't this object destroy on collision? 1 Answer
why isnt my code working, 2 Answers
Mesh collider 0 Answers
Toggle collider with key 0 Answers