i am doing a game in which a player should be able to walk through walls. Walls are 3D cubes objects in my game. I can’t just uncheck the “box collider” of the wall prefab, because I also have players who are monsters and who shall NOT be able to walk through walls, only human player can.I have tried different approaches, e.g. tagging the player and attaching a script to the wall which uses "if (collision.gameObject.tag == ""Player) {Physics.IgnoreCollision(…)}. I tried different layers for walls and players using “Physics.IgnoreLayerCollision…()…”. But Nothing works. What am I missing?
it passes through most objects even with mesh colliders applied.
The other factor depends on if you are using a capsule collider on the person or a Character Controller collider. In most cases, simply checking them to trigger will allow you character to pass through objects, but leaving the colliders on enemies as unchecked will keep them from passing through said mesh collider set objects you placed.
So that’s really the only two parts you need to check, the type of movement script and the collider type and its settings.
A game object can only be in one layer. The layer needs to be in the range [0…31]
UnityEngine.GameObject:set_layer(Int32)
Chapter1.WalkThroughWall:SetLayerToNotSolid() (at Assets/My script/Chapter1/WalkThroughWall.cs:25)
Chapter1.GameManager_EventMaster:CallMyGeneralEvent() (at Assets/My script/Chapter1/GameManager_EventMaster.cs:18)
Chapter1.TriggerExample:OnTriggerEnter(Collider) (at Assets/My script/Chapter1/TriggerExample.cs:22)