Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Our response to Improbable’s blog post (and why you can keep working on your SpatialOS game). Read more here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Capsule collider getting stuck on low objects

Discussion in 'Physics' started by dgoyette, Jan 11, 2019 at 3:35 AM.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    1,031
    I'm having an issue where my player is getting stuck on objects that are fairly low to the ground. I'm walking up to a box collider that's 0.2 units tall, which collide's with a portion of the curved part of the player's capsule collider:

    upload_2019-1-10_22-30-27.png

    The result is that I get pretty well stuck on it. I'm using a rigidbody controller, and moving backwards or forwards applies force to the player's rigidbody. When I get "stuck", I can still see that the same amount of force as usual is being applied to the rigidbody, but the player hardly moves. If I keep holding the input for 10-15 seconds, I eventually break free. And I can see the player is moving a very small amount during this time.

    So, I've confirmed I'm still applying plenty of force to the player, the Rigidbody is Continuous Dynamic, and I freeze all rotations. The exact height of the obstacle doesn't seem to matter: pretty much any low object like this causes me to get stuck.

    Does anyone have any suggestions as to what might be causing this to happen?
     
  2. SparrowsNest

    SparrowsNest

    Joined:
    Apr 6, 2017
    Posts:
    965
    Try to fiddle with the variables "shellOffset" and "groundCheckDist" (they might have a slightly different name, i've made so much changes to the built-in controller)

    I had the same issue, the value for me right now are .1 for the shellOffset and .11 for the groundCheckDist.

    take a peek in the code, i think they commented on this variables. (I might have added it and forgot, but i doubt it)

    Code (CSharp):
    1.     [Tooltip("set it to 0.1 or more if you get stuck in wall")]public float shellOffset;
    2.     [SerializeField]float groundCheckDistance = 0.01f; // distance for checking if the controller is grounded ( 0.01f seems to work best for this )
    3.  
    4.  
     
  3. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    1,031
    Interesting. I'll take a look. I'm using my own character controller, but comparing it to the 'RigidbodyFirstPersonController' from StandardAssets, it does seem I'm doing things pretty similarly.
     
  4. SparrowsNest

    SparrowsNest

    Joined:
    Apr 6, 2017
    Posts:
    965
    I was under the impression you're using the build in one for some reason.