multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.41k stars 438 forks source link

isVehicleOnGround sometimes returns false incorrectly #471

Open ArranTuna opened 6 years ago

ArranTuna commented 6 years ago

Describe the bug isVehicleOnGround returns false on some vehicles upside down and isVehicleOnGround always returns false for Monsters.

Vehicle IDs: 444, 556, 557

isVehicleOnGround(getPedOccupiedVehicle(localPlayer)) always return false

To Reproduce

Expected behavior Should return true

Screenshots image

MTA Client (please complete the following information): unstated

MTA Server (please complete the following information): unstated

Additional context From mantis 7880 and mantis 8672

qaisjp commented 6 years ago

The Monster problem should be fixed but I am not sure about vehicles that are upside down (yet on the ground) or vehicles driving on walls (with setVehicleGravity).

I invite suggestions and comments

Yamsha75 commented 2 years ago

Monster problem is still present in v1.5.9-release-21024.1. I encountered the same issue for Dune. It must be something related to their unusual suspension. Lowering suspensionForceLevel in handling fixes the problem (to 0.2 for Monster or 0.4 for Dune). That change is a bit too much for those vehicles, but maybe this will be of some help in figuring out the underlying problem

Dutchman101 commented 2 years ago

It must be something related to their unusual suspension. Lowering suspensionForceLevel in handling fixes the problem

seems very related to issue #2093 as well, and all stuff tied to it comes back to unusual suspension values. For the latter, also see my comment on that issue.

Yamsha75 commented 2 years ago

Not sure about unsual suspension values, but for typical situations using isVehicleWheelOnGround is good enough and in most cases even more precise. Just keep in mind what you consider "vehicle on ground" for your use case, in other words, which combination of wheels on ground makes the vehicle on ground: all wheels, only driven wheels, or any single wheel. Works for Monster and Dune in all my use cases anyway