UPBGE / upbge

UPBGE, the best integrated game engine in Blender
https://upbge.org
Other
1.43k stars 180 forks source link

Vehicle wrapper wheels orientation fix #1893

Closed opheroth closed 4 months ago

opheroth commented 4 months ago

Orientation on wheels was mirrored due this sign.

The attached blend was made by Musikai and stated the problem here: https://blenderartists.org/t/vehicle-loose-wheels/1520846 Vehicle_Loose_Wheels_279.zip

youle31 commented 4 months ago

Hi, I tested both in 2.79b and in 0.42alpha.

I propose the following changes instead:

p.zip

Can you test my patch and tell me if it sounds ok for you? Thanks

opheroth commented 4 months ago

Hi again, thanks for your reply. I've tried your changes proposal, but still there is a problem with mirrored axis, I've attached a file, also made by Musikai to explain the problem. You can see the image used in the cube, getting mirrored when playing the game, and that orientation error gives a wrong orientation compared with 2.79 when reading it inside the game.

In the change I've proposed, the orientation is now correct, but I forgot to modify in the KX_VehicleWrapper.cpp, the line 195: 195 force *= -1.f; That line inverts the movement, removing it fix the problem of opposite direction. Should I add the change?

To me it seems btRaycastVehicle.cpp is only related to vehicles using VehicleWrapper, but I'm really just beginning to understand the source code. Any feedback or help will be very appreciated. Thanks in advance.

Vehicle_Loose_Wheels_0.42_test.zip

youle31 commented 4 months ago

Ok, I will do the fix as you suggest directly in master, because there is an extra thing to do when we modify bullet code. Thanks very much for the fix and the tests!

youle31 commented 4 months ago

https://github.com/UPBGE/upbge/commit/6f2fca97d506ec6c686928d8540cb1e8ff1130d8