Without messing with physics layers(as I’d need different ones for every possible color) what is the best way to do this? I don’t want to enable/disable the collider based on what is touching it as if two objects hit it at the same it would cause problems.
Any suggestions appreciated, preferably in JS.
EDIT:
I have the following:
function OnCollisionExit (thingHit : Collision)
{
if(thingHit.gameObject.renderer.material.color == renderer.material.color)
Physics.IgnoreCollision(collider, thingHit.collider, false);
if(thingHit.gameObject == player)
manager.GetComponent(ColourChangeScript).switcherE nabled = true;
}
function OnCollisionEnter (thingHit : Collision)
{
if(thingHit.gameObject.renderer.material.color == renderer.material.color)
Physics.IgnoreCollision(gameObject.collider, thingHit.collider, true);
if(thingHit.gameObject == player)
manager.GetComponent(ColourChangeScript).switcherE nabled = false;
}
It isn’t ignoring the collisions at all. Any ideas?