Enemy Falling through floor

I’m setting up a simple chase mechanic, where one capsule is chasing the player. I have the script set up for it to chase fine, but I can’t get it to obey physics. If I give it a rigidbody and a capsule collider, it obeys physics but falls over instead of staying upright. If I give it a character controller and a rigidbody it falls through the floor.
If I give it a character controller and a capsule collider, it stays upright but walks through walls.

Any way to get it to stay upright and obey physics?

give it a rigidbody and then freeze its x,y,z positions/rotations to meet your criteria of not falling over (you might could keep it from falling through the floor this way but then I don’t think you could jump) :slight_smile: under “the game object name”(in hierarchy) >> rigidbody component(in inspector) >> constraints(in rigidbody)

Thank you for the quick reply. I tried constraining one and all of the axis but then it just becomes a tumbling capsule floating through space following me.

I’m trying to use a capsule to represent a character so I’d like it to stay upright, use gravity, and not walk through walls.

Thanks guys. I think I’m asking too much for this early stage in game creation. I thought there should be some way to just slap a character controller on an object and have it either not fall through the floor or walk through walls. There’s probably more advanced scripting I need to learn to get it to do what I want.

I was prototyping my game and saw this behavior too. I know this is old but thought I would add (since I didn’t see this combo listed in the existing answers) that in Unity 4 if I add Character Controller + Character Motor, the mobs/capsules did not tip over or fall through the terrain.