Possible fix for wheel bug

This commit is contained in:
Sergeanur 2019-10-06 15:42:48 +03:00
parent fe2ae13c80
commit 90aa16b9b0

View File

@ -1933,13 +1933,15 @@ CAutomobile::Render(void)
CVector frontWheelFwd = Multiply3x3(GetMatrix(), CVector(-Sin(m_fSteerAngle), Cos(m_fSteerAngle), 0.0f)); CVector frontWheelFwd = Multiply3x3(GetMatrix(), CVector(-Sin(m_fSteerAngle), Cos(m_fSteerAngle), 0.0f));
CVector rearWheelFwd = GetForward(); CVector rearWheelFwd = GetForward();
for(i = 0; i < 4; i++){ for(i = 0; i < 4; i++){
contactPoints[i] = m_aWheelColPoints[i].point - GetPosition(); if (m_aWheelTimer[i] > 0.0f) {
contactSpeeds[i] = GetSpeed(contactPoints[i]); contactPoints[i] = m_aWheelColPoints[0].point - GetPosition();
if(i == CARWHEEL_FRONT_LEFT || i == CARWHEEL_FRONT_RIGHT) contactSpeeds[i] = GetSpeed(contactPoints[i]);
m_aWheelSpeed[i] = ProcessWheelRotation(m_aWheelState[i], frontWheelFwd, contactSpeeds[i], 0.5f*mi->m_wheelScale); if (i == CARWHEEL_FRONT_LEFT || i == CARWHEEL_FRONT_RIGHT)
else m_aWheelSpeed[i] = ProcessWheelRotation(m_aWheelState[i], frontWheelFwd, contactSpeeds[i], 0.5f*mi->m_wheelScale);
m_aWheelSpeed[i] = ProcessWheelRotation(m_aWheelState[i], rearWheelFwd, contactSpeeds[i], 0.5f*mi->m_wheelScale); else
m_aWheelRotation[i] += m_aWheelSpeed[i]; m_aWheelSpeed[i] = ProcessWheelRotation(m_aWheelState[i], rearWheelFwd, contactSpeeds[i], 0.5f*mi->m_wheelScale);
m_aWheelRotation[i] += m_aWheelSpeed[i];
}
} }
// Rear right wheel // Rear right wheel