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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Question Character Controller climbs everything thats not perpendicular

Discussion in 'Editor & General Support' started by Deleted User, Jun 21, 2021.

  1. Deleted User

    Deleted User

    Guest

    Essentially what the title says.
    CC is being controlled by .Move(); with slope limit at 45.
    But it doesn't matter what settings I use. If I run against a wall that is not perpendicular, the character just climbs up that wall. It looks especially ridiculous if that's a tree:). If the wall has an exact 90-degree angle, then the CC behaves normally. If I were to make Minecraft, that would be fine. But I am not.

    Reproducible in an empty scene on:
    2019.4.xx, 2021.1.xx

    Literary every post I saw on the web with the same issue, didn't have any replies whatsoever:mad:
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,780
    I question your reproduction steps. I am able to reproduce PERFECT functionality: the CC climbs a 44-degree slop, stops at a 46-degree slope. Just tested on: Unity2019.4.15f1 and Unity2021.1.0f1

    See attached package exported from Unity2019.4.15f1
     

    Attached Files:

  3. Deleted User

    Deleted User

    Guest

    Thank you for the reply.
    I tried to use a cube (within unity) as a slope, and the character component really worked with it as you've described!
    I then started to dig a bit deeper into why this happens, and it turns out, that if you use a box collider, then the CC works as intended, but if you use a capsule collider, then it doesn't.
    To reproduce: Add an empty GO with capsule collider so that it is perpendicular to ground, rotate 10 degrees on the x-axis. Even if the slope limit is 35 or whatever, the CC will climb up that collider.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,780
    For me rotating the object did not change the slope climb behavior.

    But one thing I noticed is that if you even give it a TINY smidge of up vector (even as little as
    new Vector3( 3.0f, 0.001f);
    ), then it will happily climb slopes beyond its limit.

    Therefore it seems important that your Y movement component remain zero.

    I don't have it in front of me but I don't think I'm using ANY collider, just letting the CharCon do its thing... but if I forgot and left it in place, then it would indeed be a capsule collider. Possibly if you add a collider you are getting a "lever-up" effect going on?
     
  5. Cloudwalker_

    Cloudwalker_

    Joined:
    Jan 3, 2014
    Posts:
    134
    Also noticing the same issue, works fine on a box collider, but a capsule collider event barely tilted a few degrees and the CC can walk right up it.
     
  6. unitydevv

    unitydevv

    Joined:
    Aug 14, 2016
    Posts:
    11
    Having same issue on a capsule collider , the character just can walk right up if its a bit tilted . Did anyone found a solution?
     
  7. Radivarig

    Radivarig

    Joined:
    May 15, 2013
    Posts:
    94
    Increasing Skin Width to 0.1 helped but did not solve it completely.. That's for radius of 0.4.
     
  8. nalex66

    nalex66

    Joined:
    Aug 26, 2022
    Posts:
    41
    Having this problem too. Character Controller works properly when colliding with square level geometry, but my player keeps climbing on top of enemies with capsule colliders, even though they are taller than my character controller step limit.

    Both character and enemies have a capsule radius of 0.3, step limit is 0.25, slope limit 45°, and enemy collider is 0.75 high. Seems like maybe the height of the capsule mid-section (0.75 - 2*0.3 = 1.5) is being tested against step height and the height of the bottom curve is being ignored? It wasn't doing this when my enemies had a taller collider (I tweaked it to better match the shape of the enemy creature).

    Edit: I was able to improve the situation by adding a box collider to the lower part of my enemy creature. It needed to be 0.5 tall to stop the player riding up and over, which still seems odd given that I can't climb a step that's even 0.01 units higher than my step offset. Anyway, this setup still allowed me to keep a rounded top for my enemy collider, and the bottom shape doesn't matter as much. (The enemy uses navmesh agent to move, so the collider shape doesn't enter into locomotion, just physics interactions.)
     
    Last edited: Aug 10, 2023