Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

CharacterController collision issues

Discussion in 'Scripting' started by SentryGames, May 21, 2018.

  1. SentryGames

    SentryGames

    Joined:
    Jun 4, 2014
    Posts:
    24
    Hi all,

    I have an issue with collisions between a box collider and a character controller ...

    I don't know why, as soon as the red character start to move, me (the blue character) climb over the red character Box Collider



    the red character is controlled by an AI.

    This issue does not occured when i move against a wall, only when i try to move against the red character.
    I found a post talking about skin width, I put the value of 0,005, that solve the problem when i try to move against the red player when he is static, but not when he moves.

    Could you help me ?
     
  2. johne5

    johne5

    Joined:
    Dec 4, 2011
    Posts:
    1,133
    you could setup layers, and have the blue charator ignore the red charators layer.
    Is the red charactors collider set to trigger? i think it's not.
     
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Sounds like something easily addressed by learning trivial things in the manual or Learn section of this website.
     
  4. SentryGames

    SentryGames

    Joined:
    Jun 4, 2014
    Posts:
    24
    I don't think it's a layer issue. I want that collisions occured between my 2 characters, like when i move against a wall.

    The problem is that the behaviour goes well when the red one does not move but as soon as he starts to do some animation my blue character is able to climb ^^
     
  5. SentryGames

    SentryGames

    Joined:
    Jun 4, 2014
    Posts:
    24
  6. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    I can only replicate this if I move a collider without a rigidbody or without forces. How are you moving your AI? If I use proper forces everything works just fine.
     
  7. SentryGames

    SentryGames

    Joined:
    Jun 4, 2014
    Posts:
    24

    In black, my AI, he has a rigidbody (Kinematic) and a box collider (not Trigger). This AI wants to re-oriente him self (in the direction of the red arrow) and for that we used the NavMeshAgent (no forces apply).
    In green, my characterController, we wants to go straight forward, and, when the AI start his re-orientation, I climb the Box of the AI.

    I don't find any clue to debug this ...
     
    Last edited: May 24, 2018
  8. daxiongmao

    daxiongmao

    Joined:
    Feb 2, 2016
    Posts:
    412
    Just looking at your picture. If you were to rotate the box the corner of it would be inside your player. The character controller is probably doing raycasts from above to try and place your controller on the ground.
    It seems a little high for that but it could think now your box is the ground and it placing you on top of it.