juzzlin / DustRacing2D

Dust Racing 2D is a traditional top-down car racing game including a level editor.
http://juzzlin.github.io/DustRacing2D/index.html
GNU General Public License v3.0
300 stars 67 forks source link

Normalize steering angle #128

Closed usakhelo closed 1 year ago

usakhelo commented 1 year ago

This PR fixes #126 Not sure if this is the best way of fixing this, but it looks like when angle is outside -+360 degrees, index equals to 0 and by that sin and cos return wrong values. normalize function stolen from SO

juzzlin commented 1 year ago

Well, this limitation is documented in mctrigonom.hh header. I still don't object merging this.

juzzlin commented 1 year ago

Thanks!