Sfoglia il codice sorgente

WheelSettingsTV and WheelSettingsWV were not serializing their base class members (#1661)

Fixes #1660
Stephen Gold 1 mese fa
parent
commit
cfefdc6692

+ 1 - 0
Docs/ReleaseNotes.md

@@ -12,6 +12,7 @@ For breaking API changes see [this document](https://github.com/jrouwe/JoltPhysi
 
 ### Bug Fixes
 
+* WheelSettingsTV and WheelSettingsWV were not serializing their base class members.
 * The remap tables in `SoftBodySharedSettings::OptimizationResults`` mapped from new to old index instead of from old to new as was documented. The maps now behave as documented.
 * Fixed an issue where soft body bend constraints could be created with identical vertices. This led to an assert triggering.
 * Fixed infinite recursion when colliding a `TriangleShape` vs a `TriangleShape`.

+ 6 - 0
Jolt/Physics/Vehicle/TrackedVehicleController.cpp

@@ -26,18 +26,24 @@ JPH_IMPLEMENT_SERIALIZABLE_VIRTUAL(TrackedVehicleControllerSettings)
 
 JPH_IMPLEMENT_SERIALIZABLE_VIRTUAL(WheelSettingsTV)
 {
+	JPH_ADD_BASE_CLASS(WheelSettingsTV, WheelSettings)
+
 	JPH_ADD_ATTRIBUTE(WheelSettingsTV, mLongitudinalFriction)
 	JPH_ADD_ATTRIBUTE(WheelSettingsTV, mLateralFriction)
 }
 
 void WheelSettingsTV::SaveBinaryState(StreamOut &inStream) const
 {
+	WheelSettings::SaveBinaryState(inStream);
+
 	inStream.Write(mLongitudinalFriction);
 	inStream.Write(mLateralFriction);
 }
 
 void WheelSettingsTV::RestoreBinaryState(StreamIn &inStream)
 {
+	WheelSettings::RestoreBinaryState(inStream);
+
 	inStream.Read(mLongitudinalFriction);
 	inStream.Read(mLateralFriction);
 }

+ 6 - 0
Jolt/Physics/Vehicle/WheeledVehicleController.cpp

@@ -31,6 +31,8 @@ JPH_IMPLEMENT_SERIALIZABLE_VIRTUAL(WheeledVehicleControllerSettings)
 
 JPH_IMPLEMENT_SERIALIZABLE_VIRTUAL(WheelSettingsWV)
 {
+	JPH_ADD_BASE_CLASS(WheelSettingsWV, WheelSettings)
+
 	JPH_ADD_ATTRIBUTE(WheelSettingsWV, mInertia)
 	JPH_ADD_ATTRIBUTE(WheelSettingsWV, mAngularDamping)
 	JPH_ADD_ATTRIBUTE(WheelSettingsWV, mMaxSteerAngle)
@@ -55,6 +57,8 @@ WheelSettingsWV::WheelSettingsWV()
 
 void WheelSettingsWV::SaveBinaryState(StreamOut &inStream) const
 {
+	WheelSettings::SaveBinaryState(inStream);
+
 	inStream.Write(mInertia);
 	inStream.Write(mAngularDamping);
 	inStream.Write(mMaxSteerAngle);
@@ -66,6 +70,8 @@ void WheelSettingsWV::SaveBinaryState(StreamOut &inStream) const
 
 void WheelSettingsWV::RestoreBinaryState(StreamIn &inStream)
 {
+	WheelSettings::RestoreBinaryState(inStream);
+
 	inStream.Read(mInertia);
 	inStream.Read(mAngularDamping);
 	inStream.Read(mMaxSteerAngle);