From 90aa16b9b01ee1fc394e9ad984ddccaabb83257a Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 6 Oct 2019 15:42:48 +0300 Subject: Possible fix for wheel bug --- src/vehicles/Automobile.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/vehicles') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 67d80915..00dc73fc 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -1933,13 +1933,15 @@ CAutomobile::Render(void) CVector frontWheelFwd = Multiply3x3(GetMatrix(), CVector(-Sin(m_fSteerAngle), Cos(m_fSteerAngle), 0.0f)); CVector rearWheelFwd = GetForward(); for(i = 0; i < 4; i++){ - contactPoints[i] = m_aWheelColPoints[i].point - GetPosition(); - contactSpeeds[i] = GetSpeed(contactPoints[i]); - if(i == CARWHEEL_FRONT_LEFT || i == CARWHEEL_FRONT_RIGHT) - m_aWheelSpeed[i] = ProcessWheelRotation(m_aWheelState[i], frontWheelFwd, contactSpeeds[i], 0.5f*mi->m_wheelScale); - else - m_aWheelSpeed[i] = ProcessWheelRotation(m_aWheelState[i], rearWheelFwd, contactSpeeds[i], 0.5f*mi->m_wheelScale); - m_aWheelRotation[i] += m_aWheelSpeed[i]; + if (m_aWheelTimer[i] > 0.0f) { + contactPoints[i] = m_aWheelColPoints[0].point - GetPosition(); + contactSpeeds[i] = GetSpeed(contactPoints[i]); + if (i == CARWHEEL_FRONT_LEFT || i == CARWHEEL_FRONT_RIGHT) + m_aWheelSpeed[i] = ProcessWheelRotation(m_aWheelState[i], frontWheelFwd, contactSpeeds[i], 0.5f*mi->m_wheelScale); + else + m_aWheelSpeed[i] = ProcessWheelRotation(m_aWheelState[i], rearWheelFwd, contactSpeeds[i], 0.5f*mi->m_wheelScale); + m_aWheelRotation[i] += m_aWheelSpeed[i]; + } } // Rear right wheel -- cgit v1.2.3 From dd602eb4a4064537fbe86f6539b9fc39b3245b85 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 6 Oct 2019 15:49:01 +0300 Subject: Fixing ColPoints again --- src/vehicles/Automobile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vehicles') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 00dc73fc..2329a9d9 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -1934,7 +1934,7 @@ CAutomobile::Render(void) CVector rearWheelFwd = GetForward(); for(i = 0; i < 4; i++){ if (m_aWheelTimer[i] > 0.0f) { - contactPoints[i] = m_aWheelColPoints[0].point - GetPosition(); + contactPoints[i] = m_aWheelColPoints[i].point - GetPosition(); contactSpeeds[i] = GetSpeed(contactPoints[i]); if (i == CARWHEEL_FRONT_LEFT || i == CARWHEEL_FRONT_RIGHT) m_aWheelSpeed[i] = ProcessWheelRotation(m_aWheelState[i], frontWheelFwd, contactSpeeds[i], 0.5f*mi->m_wheelScale); -- cgit v1.2.3