Skip to content

CharacterController.IsGrounded seems buggy #2814

@codeabuse

Description

@codeabuse

Release Type: Official Release
Version: 4.2.0.2381
Platform(s): Windows 10

I created a new project from First Person Shooter template and started from adding Jump to PlayerController script:
(the event stuff is outside of the scope, Jump is called from Update)

private void Jump()
{
    if (character.IsGrounded)
    {
        if (isJumping)
        {
            Log.Info("Landed");
            isJumping = false;
        }
        jumpEventListener.TryReceive(out var jumpPressed);
        if (!jumpPressed)
        {
            return;
        }
        var jumpDirection = new Vector3(moveDirection.X, 1, moveDirection.Z);
        jumpDirection.Normalize();

        character.Jump(jumpDirection * JumpHeight);
        isJumping = true;
        Log.Info("Jumping!");
    }
    else Log.Info("In air!");
}

To me it seems like the CharacterController's IsGrounded property is hella bugged since I can just hold Space key and fly up, which obviously shouldn't happen.

To Reproduce
Steps to reproduce the behavior:

  1. Create new project from First Person Template
  2. Extend PlayerController with my method, hook it up to Jump key event from PlayerInput.

Expected behavior
Jump works.

Screenshots
Here's the screenshot of a single short key press result (multiple landings and jumps after it did not happened because of the input):
Image

From what I'm seeing it jumps three times per key stroke, for that it also lands three times because it detects grounded state while being midair.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions