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.35k stars 413 forks source link

setVehicleModelWheelSize doesn't change default wheel size properly #2057

Open Rartii opened 3 years ago

Rartii commented 3 years ago

Describe the bug

setVehicleModelWheelSize doesn't change stock wheel visual scale properly.

To reproduce

Change rear only: Size changes properly. Change front only: Front wheel scale stays the same. Rear wheels end up smaller if the front one was made bigger or larger if the front one was made smaller. Change both: No size change

Expected behaviour

If the car has the default wheels the visual size will not match. On the custom wheels this issue does not happen.

Screenshots

image

Version

v1.5.8-release-20809

Additional context

The wheel scale change only seems to affect the rear axle, the front axle applies negative scale to the rear wheels and this might be the reason why they are the same default size when both axles are changed.

AlexTMjugador commented 3 years ago

As the author of the PR that added this function to MTA, allow me to explain what I think it's going on here.

It seems that R* original vision for vehicle wheel sizes aimed at solving two problems: telling the game engine how big the wheels actually are (so the appropriate collision and ground clearance can be calculated) and representing the relationship between the sizes of the wheels in each axle. IMO, the way they used vehicle wheel sizes to solve these problems (which is exposed in MTA via setVehicleModelWheelSize) is smart, and although it might seem odd at a first glance, understanding how different "pieces" of the game work together will help making sense of it.

Let's see in detail how GTA: SA uses the wheel size data for rendering vehicles according to whether they have wheel upgrades or not:

The bottom line is that the GTA: SA behavior (and, in turn, MTA: SA's) you report is, thus, correct and to be expected. The function is working as intended. I reckon this might sound complex or dense at a first glance, but once you get the hang of it, it's not an issue.