Announcement

Collapse
No announcement yet.

Character Mesh Off Ground issue (w/ video)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Character Mesh Off Ground issue (w/ video)

    Hey everybody,

    in my current 4.11 project, I'm experiencing a strange behaviour from my character mesh.

    When initially standing on a surface, the collision works just fine, there is no offset from the ground.
    However, when I move a few steps, the mesh suddenly slides upwards a few inches.
    After that, when walking it stays at that offset and will not return to the ground.
    Then again, a jump seems to reset the offset, and I land at the correct ground level again.

    Uploaded a quick video for context, with all collisions shown:
    https://youtu.be/1huBc7F5EAU
    See how in 0:04, the mesh slides upwards and stays there until after the jump in 0:09, just to slide upwards again in 0:11.

    I admit my character is pretty custom, e.g. height and width of the capsule are the same.. It's still based off the base character class though.

    I noticed that while on a perfectly horizontal surface, there is no offset. On a slightly tilted surface like in the video, it only happens when moving downwards (left in the video). When the tilt of the platform exceeds 15° or so, the offset is always there, no matter what direction you walk.

    The height of the offset however is always the same. So when I scale up my character in the editor, the offset become less in relation to the character's size. But for my current (virtual reality miniature world) game, i really need the character small, or my levels become too large and performance drops significantly.

    Anyone seen this behavior elsewhere? I would just love to know what triggers this offset. Apparently there has to be some event that actively offsets the whole character from the previously correctly calculated position - if not, the mesh would always be offset.

    Thanks in advance for any hint in the right direction.

    #2
    Wonder if it's the animation root or footstep like I've had walking animations in a biped I had to scale the hip so it's relative. And it out him back on the ground as his base idle pose.
    Inphidel / Brian - Developer of Ultraball
    http://www.ultraballgame.com

    Don't shy away from bugs in your game. Don't play it as intended. Break your game so you can fix it!

    Comment


      #3
      Thanks Inph1del,
      I considered something with the anim root, but in the video you can see the collision capsule rendered as well. The mesh position doesn't change relative to the capsule, but rather the whole capsule slides off-ground.
      Also, it's working fine on perfectly horizontal surfaces with both walking and idle animations. It's the inconsistency of the issue that gives me a headache..

      Comment


        #4
        Well I'd eliminate the envoirment and move the character into a new empty level to test.

        Check the collisions in the mesh and ensure nothing's build in to it. That's making a bone push it up somehow.

        Looks like it's always going up the same height. And after walking. Jumping resets its height somehow which brings me back to the anim blue print.
        Inphidel / Brian - Developer of Ultraball
        http://www.ultraballgame.com

        Don't shy away from bugs in your game. Don't play it as intended. Break your game so you can fix it!

        Comment


          #5
          Also to narrow things down if you turn off its animations so it slides around when moving see if it pops up
          Inphidel / Brian - Developer of Ultraball
          http://www.ultraballgame.com

          Don't shy away from bugs in your game. Don't play it as intended. Break your game so you can fix it!

          Comment


            #6
            Thanks once again,
            so I tested again in a new level, with all collisions turned off except for the capsule collision and the floor collision.
            I also disabled all animations.
            Unfortunately, it's the same behaviour, the capsule floats up once I move downwards (moving upwards somehow works fine).
            Here's the second video:
            https://youtu.be/rOWh8XkgHOk
            I entered "show collisions" in the console, so that all collisions are shown. You can clearly see the gap between capsule and floor.

            However, I found an old thread from 2014 that helped me a lot.
            By typing the console command:
            displayall CharacterMovementComponent CurrentFloor
            you can get all results of the currentfloor (inside the movementcomponent), including "floor distance".
            See how in the video the "floor distance" stat (the 4th red line) accurately reads the offset (0 when on the ground, 2.1x when floating).

            In the 2014 thread, this is explained as to make sure the character doesn't sink in the ground.
            It's actually not a problem with the default UE4 3rd person character because of his size - the few inches off the ground don't matter in relation. With my little spider however, it makes out almost have of its height, which is too much.

            Next, I checked out the c++ class of the character movement component, and voilà, there are two values "MAX_FLOOR_DISTANCE" and "MIN_FLOOR_DISTANCE" which are later used to lift the character off the ground by this amount.

            So at this point, I realize "animation" is probably the wrong category for my thread. I should rephrase my question:
            How can get my character to use custom values in its movement component?

            My first idea was to go into visualstudio and edit the values directly in the default movement component class. However, this does not lower the "floor distance" of the currentfloor at all. It seems this default class isn't read any more by my character once the character has been created.

            So what about this approach:
            1. clone the base character and base movement component classes
            2. edit the values in the new movement component class
            3. reparent my character to the new cloned class

            Does this have a chance to work? I'm not too experienced with c++ in UE4, but this would be my best guess...

            Comment

            Working...
            X