1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-25 20:02:40 +01:00

Replace manual conversion with glm's function

Glm allows to use angle manipulation functions. One of them is conversion degrees to radians.
It gives optimal precision and isn't strictly connected with float.
https://glm.g-truc.net/0.9.4/api/a00136.html#ga4fb76e28851c9ff6653532566084e091
// Please close https://github.com/rwengine/openrw/pull/295 New pull request prevents trash in history, and it's easier to read.
This commit is contained in:
ShFil119 2017-06-18 18:10:46 +02:00 committed by GitHub
parent 963f490cf0
commit d08c2686e1

View File

@ -264,7 +264,7 @@ void VehicleObject::tickPhysics(float dt) {
if (wi.m_bIsFrontWheel) {
float sign = std::signbit(steerAngle) ? -1.f : 1.f;
physVehicle->setSteeringValue(
std::min(info->handling.steeringLock * (3.141f / 180.f),
std::min(glm::radians(info->handling.steeringLock),
std::abs(steerAngle)) *
sign,
w);
@ -294,7 +294,7 @@ void VehicleObject::tickPhysics(float dt) {
if (isInWater()) {
float sign = std::signbit(steerAngle) ? -1.f : 1.f;
float steer =
std::min(info->handling.steeringLock * (3.141f / 180.f),
std::min(glm::radians(info->handling.steeringLock),
std::abs(steerAngle)) *
sign;
auto orient = collision->getBulletBody()->getOrientation();