Answers for "//Unity rigidbody drag and top speed relation:"

C#
0

//Unity rigidbody drag and top speed relation:

// If you want a rigidbody with non-zero drag to achieve a particular top speed (velocity.magnitude, always positive), use one of this equations:
rb.drag = sumOfAppliedAccelerations.magnitude / (topSpeed + sumOfAppliedAccelerations.magnitude * Time.fixedDeltaTime);
rb.drag = sumOfAppliedForces.magnitude / (rb.mass * topSpeed + sumOfAppliedForces.magnitude * Time.fixedDeltaTime);
// Conversely, top speed of a rigidbody with non-zero drag can be calculated from this equations:
topSpeed = sumOfAppliedAccelerations.magnitude * (1f / rb.drag - Time.fixedDeltaTime);
topSpeed = sumOfAppliedForces.magnitude / rb.mass * (1f / rb.drag - Time.fixedDeltaTime);
Posted by: Guest on June-14-2021

Code answers related to "//Unity rigidbody drag and top speed relation:"

C# Answers by Framework

Browse Popular Code Answers by Language