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.42k stars 438 forks source link

Wearing a Jetpack or flying a Plane manipulates nearClipDistance() #1095

Open Einheit-101 opened 5 years ago

Einheit-101 commented 5 years ago

Describe the bug Wearing a jetpack and flying with it in a certain height changes the nearClipDistance. You can simply prove it by freezing the player in the air while moving the camera close to an object, near clip distance changes as soon as the player is equipped with a Jetpack. The bug affects my new water shader.

To reproduce Create an object without collision in map editor in a height of at least 10 meters - GTA changes near clip distance as soon as the camera Z position is 10m or higher (confirmed). Move close to that object with Jetpack, freeze player with admin panel and try to cross the camera with the object. Now toggle Jetpack on/off and see how the near clip distance changes.

Expected behaviour Flying with jetpack or aircraft should not affect near clip distance in the way it does. Setting it to any value above 2.99 will always result in a change as soon as the camera reaches 10m or higher. In order to prevent this bug from happening, a server owner always has to use near clip values of 2.99 or lower.

Video https://youtu.be/GfH0AfNn6BA

nearClip without jetpack without jetpack

nearClip with jetpack with jetpack

MTA Windows 1.5.7-release-20157

Additional context It also happens when sitting in an aircraft at a certain height. It does not happen when flying in a car at a certain height. This proves that GTA definitely checks for certain things when changing near clip distance.

Einheit-101 commented 5 years ago

I updated the bug report with my newest investigations. GTA additionally modifies near clip distance when the value is set to 3 (default) or higher, lower values than 3 work as intended.