Path: blob/master/thirdparty/jolt_physics/Jolt/Physics/Vehicle/VehicleDifferential.h
9912 views
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)1// SPDX-FileCopyrightText: 2021 Jorrit Rouwe2// SPDX-License-Identifier: MIT34#pragma once56#include <Jolt/ObjectStream/SerializableObject.h>7#include <Jolt/Core/StreamIn.h>8#include <Jolt/Core/StreamOut.h>910JPH_NAMESPACE_BEGIN1112class JPH_EXPORT VehicleDifferentialSettings13{14JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, VehicleDifferentialSettings)1516public:17/// Saves the contents in binary form to inStream.18void SaveBinaryState(StreamOut &inStream) const;1920/// Restores the contents in binary form to inStream.21void RestoreBinaryState(StreamIn &inStream);2223/// Calculate the torque ratio between left and right wheel24/// @param inLeftAngularVelocity Angular velocity of left wheel (rad / s)25/// @param inRightAngularVelocity Angular velocity of right wheel (rad / s)26/// @param outLeftTorqueFraction Fraction of torque that should go to the left wheel27/// @param outRightTorqueFraction Fraction of torque that should go to the right wheel28void CalculateTorqueRatio(float inLeftAngularVelocity, float inRightAngularVelocity, float &outLeftTorqueFraction, float &outRightTorqueFraction) const;2930int mLeftWheel = -1; ///< Index (in mWheels) that represents the left wheel of this differential (can be -1 to indicate no wheel)31int mRightWheel = -1; ///< Index (in mWheels) that represents the right wheel of this differential (can be -1 to indicate no wheel)32float mDifferentialRatio = 3.42f; ///< Ratio between rotation speed of gear box and wheels33float mLeftRightSplit = 0.5f; ///< Defines how the engine torque is split across the left and right wheel (0 = left, 0.5 = center, 1 = right)34float mLimitedSlipRatio = 1.4f; ///< Ratio max / min wheel speed. When this ratio is exceeded, all torque gets distributed to the slowest moving wheel. This allows implementing a limited slip differential. Set to FLT_MAX for an open differential. Value should be > 1.35float mEngineTorqueRatio = 1.0f; ///< How much of the engines torque is applied to this differential (0 = none, 1 = full), make sure the sum of all differentials is 1.36};3738JPH_NAMESPACE_END394041