Ignoring raycast and collision using layers

HI All,

I have a primarily game object with a mesh collider attahced to it and I layered it Ignore Raycast since I don’t want any ray hitting this object. I aslo don’t want some other game object to collide with this primarily game object so I thought to use Unity 3 collision matrix but my primiraly game object is already layered with the Ignore RayCast layer.
Can I attached a game object to more than one layer? and if not I can I solve my problem?

Thank u in advance

The ‘ignore raycast’ layer doesn’t actually do anything magical- if you don’t specify a manual layermask for you raycast, it hits everything but the ‘ignore raycast’ layer. However, you can make your own layermasks for raycasts, so it is quite possible to have your object on a layer other than ‘ignore raycast’ and still have it ignored by certain raycasts. Mind blowing, I know.

In answer to your actual question, no you can’t have an object on more than one layer. If it’s just one specific object you don’t want colliding with it, you can use

Physics.IgnoreCollision(object1.collider, object2.collider);

to specifically disable collisions on a per-object basis.