VehicleAntiRollBar.h 1.0 KB

123456789101112131415161718192021222324252627282930
  1. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  2. // SPDX-License-Identifier: MIT
  3. #pragma once
  4. #include <ObjectStream/SerializableObject.h>
  5. #include <Core/StreamIn.h>
  6. #include <Core/StreamOut.h>
  7. namespace JPH {
  8. /// An anti rollbar is a stiff spring that connects two wheels to reduce the amount of roll the vehicle makes in sharp corners
  9. /// See: https://en.wikipedia.org/wiki/Anti-roll_bar
  10. class VehicleAntiRollBar
  11. {
  12. public:
  13. JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(VehicleAntiRollBar)
  14. /// Saves the contents in binary form to inStream.
  15. void SaveBinaryState(StreamOut &inStream) const;
  16. /// Restores the contents in binary form to inStream.
  17. void RestoreBinaryState(StreamIn &inStream);
  18. int mLeftWheel = 0; ///< Index (in mWheels) that represents the left wheel of this anti-rollbar
  19. int mRightWheel = 1; ///< Index (in mWheels) that represents the right wheel of this anti-rollbar
  20. float mStiffness = 1000.0f; ///< Stiffness (spring constant in N/m) of anti rollbar, can be 0 to disable the anti-rollbar
  21. };
  22. } // JPH