0.2.0-dev Download ZIP
33 lines ·1.2 KB Raw
| 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) |
| 2 | // SPDX-FileCopyrightText: 2021 Jorrit Rouwe |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | |
| 5 | #pragma once |
| 6 | |
| 7 | #include <Jolt/ObjectStream/SerializableObject.h> |
| 8 | #include <Jolt/Core/StreamIn.h> |
| 9 | #include <Jolt/Core/StreamOut.h> |
| 10 | |
| 11 | JPH_NAMESPACE_BEGIN |
| 12 | |
| 13 | /// An anti rollbar is a stiff spring that connects two wheels to reduce the amount of roll the vehicle makes in sharp corners |
| 14 | /// See: https://en.wikipedia.org/wiki/Anti-roll_bar |
| 15 | class JPH_EXPORT VehicleAntiRollBar |
| 16 | { |
| 17 | JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, VehicleAntiRollBar) |
| 18 | |
| 19 | public: |
| 20 | /// Saves the contents in binary form to inStream. |
| 21 | void SaveBinaryState(StreamOut &inStream) const; |
| 22 | |
| 23 | /// Restores the contents in binary form to inStream. |
| 24 | void RestoreBinaryState(StreamIn &inStream); |
| 25 | |
| 26 | int mLeftWheel = 0; ///< Index (in mWheels) that represents the left wheel of this anti-rollbar |
| 27 | int mRightWheel = 1; ///< Index (in mWheels) that represents the right wheel of this anti-rollbar |
| 28 | float mStiffness = 1000.0f; ///< Stiffness (spring constant in N/m) of anti rollbar, can be 0 to disable the anti-rollbar |
| 29 | }; |
| 30 | |
| 31 | using VehicleAntiRollBars = Array<VehicleAntiRollBar>; |
| 32 | |
| 33 | JPH_NAMESPACE_END |