Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Character Controller Collision only works in one direction

Discussion in 'Editor & General Support' started by OverripeBanana99, Jul 12, 2023.

  1. OverripeBanana99

    OverripeBanana99

    Joined:
    Jun 30, 2023
    Posts:
    3
    Hi, I'm pretty new to Unity, so apologies if this is a stupid question. I've created a Character Controller and a room with a box collider. For some reason, the Character Controller will go through the walls of the room going in one direction, but walking in the other direction, it will collide normally with the walls.
     
  2. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,623
    I'm not sure if I'm understanding your situation correctly, but you'll need a physics collider on all objects you want your character collider to collide with. So if you have a capsule collider on the character, and a box collider on each wall, so long as your character is approaching from the outside and doesn't start within a wall, the capsule and boxes should collide and not penetrate. However, this is just a simulation, and usually at high speeds of movement you can get some accidental crossing of boundaries.

    Colliders are definitely a good thing to explore as you begin with Unity. Read up on what the manual says and maybe watch a few short YouTube videos or something, till you feel comfortable with it.
     
  3. OverripeBanana99

    OverripeBanana99

    Joined:
    Jun 30, 2023
    Posts:
    3
    Thanks for the advice :)) Just to clarify, my character controller collides with the wall when walking from outside the room but goes through the wall when walking from inside the room.
     
  4. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,623
    That doesn't really clarify things for me, as it doesn't change my mental image. So if you still need help, I suggest accessing the visual documentation / tutorials / guides. It's probably something very simple that you're missing.
     
  5. OverripeBanana99

    OverripeBanana99

    Joined:
    Jun 30, 2023
    Posts:
    3
    Ok thanks :)