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

Character collider will not pass under/through holes in walls

Discussion in 'Physics' started by rstorm000, Jul 9, 2015.

  1. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    I have a character collider which is clearly smaller than a mesh collider hole that it is trying pass through with Unity 5. The characters were able to pass through this with Unity 4, but now will not fit. Here in this picture you can clearly see the size of the collider (the sphere at the character's chest). (Note: the rest of those colliders are just triggers)



    Skin width settings have also been set to minimal amounts and still the issues persist.
     
  2. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    bump, seems pretty important if colliders don't fit though things
     
    Last edited: Jul 14, 2015
  3. DerpMerf

    DerpMerf

    Joined:
    Jan 1, 2014
    Posts:
    33
    Are you sure there's not a collider at the position of the hole?
     
  4. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    Yes, this happens with different holes as well. In Unity 4, the characters could pass, not in Unity 5. That said, sometimes the the characters would have a little bit of trouble in Unity 4, but would still pass by.
     
  5. DerpMerf

    DerpMerf

    Joined:
    Jan 1, 2014
    Posts:
    33
    Is there any code related to this that you could show us?
     
  6. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    This is mostly the character collider with the character motor script
     
  7. DerpMerf

    DerpMerf

    Joined:
    Jan 1, 2014
    Posts:
    33
    That's interesting. Are there any colliders at all that could possible be affecting this, such as a wall, or a wall behind the wall, or anything at all?
     
  8. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228

    Here is the default First Person Controller from U4 passing through 2 default boxes that have a thin horizontal with. This slide through quickly and just fine with no hiccups.

    Here's the same character controller and the same boxes but it will not pass under this box.


    At this height, the controller stops at the edge at first and then slowly squeezes underneath the box. This is almost twice the height of the controller.
     
  9. DerpMerf

    DerpMerf

    Joined:
    Jan 1, 2014
    Posts:
    33
    To be honest, I really have no clue. That doesn't make any sense. Perhaps you should report it as a bug, or go to unity answers?
     
  10. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    After more tooling around, it seems to be a problem with Step Offset. This must have changed somewhat between Unity 4 and Unity 5. When I lower the step height to between .1 and .3 it will pass under that no problem. So maybe it's trying to step up onto the block before it goes under? Still kind of doesn't make sense. Might have to do step offset changes per areas (which is kind of annoying)
     
  11. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228
    Oh another strange thing that is happening, if you start scaling the height of the character controller down, it actually seems to check the step height against itself. As you shrink it down, it will "jump" in the air for a second as if trying to go up a step. Maybe this is part of the source of the problem?
     
  12. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    228

    notice the character jumps around weirdly as you mess with height, it will happen even is step offset is 0, but it also seems to be influenced by the step offset in different ways.
     
  13. HiddenMonk

    HiddenMonk

    Joined:
    Dec 19, 2014
    Posts:
    987