system
1
Okay, so i have these robots, big robots, that i want to kill people when it gets near them, so i have a sphere that follows their feet. and it is scripted with the following instadeathcollider:
function OnTriggerEnter (col : Collider) {
var player : FPSPlayer = col.GetComponent(FPSPlayer);
if (player) {
player.ApplyDamage(10000);
} else if (col.rigidbody) {
Destroy(col.rigidbody.gameObject);
} else {
Destroy(col.gameObject);
}
}
function Reset () {
if (collider == null)
gameObject.AddComponent(BoxCollider);
collider.isTrigger = true;
}
How do i make it so it ignores the collision between the sphere and the robot ????
Physics.IgnoreCollision?
Tetrad
2
You could set up your robots with tags and then query whether or not the object you're colliding with has your robot tag. If it does, you early out.
http://unity3d.com/support/documentation/Components/Tags.html
Like this
function OnCollisionEnter(collision:Collision)
{
if(collision.gameObject.tag == "Robot")
{
Debug.Log("it's a robot");
return;
}
// rest of your code
}
Loius
3
Yes. Physics.IgnoreCollision is exactly how you'd ignore physics collisions between two objects.