-
-
Notifications
You must be signed in to change notification settings - Fork 480
Description
Describe the bug
Current isPedOnGround function is very unstable and sometimes doesn't even show the ped is on ground while he is.
To reproduce
function checkDistanceBetweenPlayerAndGround()
local x, y, z = getElementPosition(localPlayer)
local z2 = getGroundPosition(x, y, z)
local dist = getDistanceBetweenPoints3D(x, y, z, x, y, z2)
local ground = tostring(isPedOnGround(localPlayer))
outputChatBox("Distance: "..dist.." IsOnGround: "..ground)
end
crun setTimer(checkDistanceBetweenPlayerAndGround, 1000, 60)
-- Some where I found that returns false when it shouldn't:
crun setElementPosition(localPlayer, -230.175, -1107.408, 16.42)
-- If you don't get it there just move around in that area and eventually you'll see it return false.
Expected behaviour
Return true when on ground.
Screenshots
Here's the video illustrating the problem: http://youtu.be/-qMeC5M4pks
MTA Client:
Unstated.
MTA Server:
Unstated.
Additional context
I'm stood in the road and crun isPedOnGround(localPlayer)
returns false.
If you don't get it first time, keep moving and it will eventually return false when it shouldn't.
Edit: It seems that isPedOnGround fails if your feet aren't actually touching the floor because you're stood on a slope and your feet are slightly off the ground but you're still on the ground though so this function shouldn't be returning false.