Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getPedMoveState can return "fall" when standing on certain surfaces #1590

Open
Einheit-101 opened this issue Aug 2, 2020 · 2 comments
Open
Labels
bug Something isn't working

Comments

@Einheit-101
Copy link

Einheit-101 commented Aug 2, 2020

Describe the bug
Sometimes i get "fall" even when the player is standing solid and fine.

To reproduce

  1. Go to the editor

  2. Move on the roof of this house
    image

  3. crun getPedMoveState(localPlayer)

  4. Profit

Expected behaviour
The function should return "stand"

Additional information
It also returns "fall" even when sprinting or doing whatever else. And the bug does not appear on the whole roof surface.

Multi Theft Auto v1.5.7-release-20597

@Lpsd
Copy link
Member

Lpsd commented Aug 7, 2020

Could be related to the behaviour of CClientPed::IsOnGround() (#534)

See

else if (!IsOnGround() && !GetContactEntity())
return MOVEMENTSTATE_FALL;
and
bool CClientPed::IsOnGround()
{
CVector vecPosition;
GetPosition(vecPosition);
float fGroundLevel = static_cast<float>(g_pGame->GetWorld()->FindGroundZFor3DPosition(&vecPosition));
return (vecPosition.fZ > fGroundLevel && (vecPosition.fZ - fGroundLevel) <= 1.0f);
}

I'll investigate later.

@Unde-R
Copy link
Contributor

Unde-R commented Aug 7, 2020

Could be related to the behaviour of CClientPed::IsOnGround() (#534)

See

else if (!IsOnGround() && !GetContactEntity())
return MOVEMENTSTATE_FALL;

and

bool CClientPed::IsOnGround()
{
CVector vecPosition;
GetPosition(vecPosition);
float fGroundLevel = static_cast<float>(g_pGame->GetWorld()->FindGroundZFor3DPosition(&vecPosition));
return (vecPosition.fZ > fGroundLevel && (vecPosition.fZ - fGroundLevel) <= 1.0f);
}

I'll investigate later.

Yeah, i've just checked it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants