Add options for vehicle wheel suspension configuration and state

This commit is contained in:
Wojtek Figat
2021-08-09 14:35:22 +02:00
parent fd01d37002
commit 09c11250b4
3 changed files with 38 additions and 7 deletions

View File

@@ -845,10 +845,12 @@ void Physics::CollectResults()
state.TireContactPoint = P2C(perWheel.tireContactPoint);
state.TireContactNormal = P2C(perWheel.tireContactNormal);
state.TireFriction = perWheel.tireFriction;
state.SteerAngle = RadiansToDegrees * perWheel.steerAngle;
state.RotationAngle = -RadiansToDegrees * drive->mWheelsDynData.getWheelRotationAngle(j);
const float suspensionOffsetDelta = perWheel.suspJounce - state.SuspensionOffset;
state.SuspensionOffset = perWheel.suspJounce;
const float wheelRotationAngle = -RadiansToDegrees * drive->mWheelsDynData.getWheelRotationAngle(j);
const float wheelSteerAngle = RadiansToDegrees * perWheel.steerAngle;
wheelData.Collider->SetLocalOrientation(Quaternion::Euler(0, wheelSteerAngle, wheelRotationAngle) * wheelData.LocalOrientation);
wheelData.Collider->SetLocalOrientation(Quaternion::Euler(0, state.SteerAngle, state.RotationAngle) * wheelData.LocalOrientation);
}
}
}