My character keeps on going out the box

I have a character and a cube. The character is inside the cube. When I tried to move around, the character keeps on going out. I already put a collider on a cube, a mesh collider and a capsule collider on the character. What is the problem? Please help me. Thanks

The problem is collisions only happen with objects out of the colliders. Put the character inside a wall of cubes all around.

Are you saying that I’m going to duplicate my character? Sorry, I don’t get your suggestion. Will you please clarify it? Thank you!

If your character is inside another collider no collisions are detected. Even if your character moves out. If he moves out and then back in, then collision is triggered.

What am I going to do? :frowning:

if you want to block movement of your character, just place colliders all around him not over him. Or you can make the cube a trigger if you want to stop the character programmatically. Can you better explain what do you want to achieve?

I’m sorry. I’ve tried to look at the scene while playing and I’ve seen the character, it’s not going out of the cube. The camera of the character is the one that makes the outside of the cube be seen. I like to make the camera see only the inside of the cube and the character only inside the character. But what’s happening is, the camera can see the outside when it’s in front of the cube. Here’s the screenshot. Hope you get it.

Ahhh… I was thinking your cube as a primitive scaled cube but it’s more like a room. You have a third person camera and you want it to consider collisions so it stays in the cube with the character is following. I never tryed it but I have seen such a camera in the free unity sample assets beta: https://www.assetstore.unity3d.com/en/#!/content/14474