Prof-Butts / xwa_ddraw_d3d11

Direct3D 11 implementation of DDraw.dll for XWA with VR support and New Shaders
MIT License
6 stars 4 forks source link

Gimbal Lock Fix. #75

Closed Prof-Butts closed 1 year ago

Prof-Butts commented 1 year ago

The basic idea is to use a Right, Up, Forward orthonormal vector basis system and then translate that back into XWA's yaw, pitch, roll. Then we can overwrite the ship's yaw, pitch, roll in the player's ObjectEntry slot.

The RUF system is reortho on every frame and renormalized, that way precision errors are not accumulated.

If the PlayerRUF and XWA's mobileObject orientation matrix get out of sync, the code will re-initialize PlayerRUF. This effectively makes PlayerRUF get the proper initial values.

To enable mouse support, do the following in DDraw.cfg:

JoystickEmul = 1
MouseSensitivity = 2.0