- Home /
Having trouble with Physics.IgnoreCollision().
I was trying to use http://docs.unity3d.com/ScriptReference/Physics.IgnoreCollision.html but i'm currently having problems. Right now what i'm trying to do is give a certain object permissions to go through another object. This is my code -
var Player : GameObject;
function Start ()
{
Physics.IgnoreCollision(Player.collider, collider);
}
function Update ()
{
}
I attached this script to the object that i want "Player" to go through, and set "Player" as my player in the inspector (my player is currently a cube that can move around). But when i run it, my player still cant pass through the object i want it to pass through, do you know what i did wrong?
P.S. - sorry if this is a newbie question, i have a lot to learn about unity related things and and trying my hardest, thanks!
Answer by Baste · Nov 11, 2014 at 10:27 AM
Physics.IgnoreCollision isn't persistent, and has a bunch of drawbacks, so I wouldn't use it.
The usual way to fix your problem is to set the player and the object the player should walk through on their own layers, and set those to not collide in the physics settings (Edit->Project Settings->Physics).
Hope that helps!
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Rigidbody Collision Question 1 Answer
Ignore Collision problem 1 Answer
collision with objects, physics 1 Answer
Physics.IgnoreCollision not working 0 Answers