Character walking through objects

Hi everyone,

The models I have have been created in 3DS Max but I was wondering. How do you stop the character from walking through objects?

For example, I have a barn and when a player moves into the barn they walk straight through walls. I was wondering how do I fix that?

Put colliders on them, if you’re using physics.

Otherwise, put colliders on them and either start using physics, or else raycast to see if you’ve hit one before you move.

If you’re using NavMeshes you can put a NavMeshModifier on the objects you don’t want to be able to walk through and set the Override Area Type to ‘not walkable’.

https://docs.unity3d.com/Manual/class-NavMeshModifier.html

1 Like