I instantiate a ball in a gameObject script of a character so that the character has a ball to play with.
I try to ignore collisions between the ball and the gameObject and when I do I get this error.
Ignore collision failed. Both colliders need to be activated when calling this IgnoreCollision
ball=Instantiate(Resources.Load("Sphere"));
ball.name=gameObject.name+"ball";
ball.rigidbody.isKinematic=true;
ball.rigidbody.useGravity=false;
ball.GetComponent(SphereCollider).isTrigger=false;
Physics.IgnoreCollision(ball.GetComponent(SphereCollider),gameObject.GetComponent(SphereCollider));
Is this happening because something is not fully loaded? How do I fix it?
↧