- Home /
How to get a Character Controller to not collide with certain objects?
I need a character controller to not collide with certain objects that I specify. For instance, my player shoots a bullet that is instantiated at the player's transform.position, but I don't want there to be any physics between the player and the bullet.
My guess was to put them on different layers, but that didn't work. Would I have to use some kind of Layer Mask, and if so, how would that be implemented?
Thanks :)
Answer by yogee · Nov 12, 2013 at 04:34 AM
Physics.IgnoreCollision(bullet.collider, collider);
//collider is a Character Controller
Thanks so much! It worked. Sorry, can't upvote your answer, not enough rep, but thanks anyways for the fast response.
Is there a way to get a prefab of a bullet not to collide with all other bullets. Would I really have to find all bullet game objects in the seen and set them to ignore collisions? Seems inefficient.