Просмотр исходного кода

Added documentation on the magnitude of stiffness.

Jorrit Rouwe 1 год назад
Родитель
Сommit
d8a294d592
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      Jolt/Physics/Constraints/SpringSettings.h

+ 4 - 0
Jolt/Physics/Constraints/SpringSettings.h

@@ -53,6 +53,10 @@ public:
 		/// Valid when mSpringMode = ESpringMode::StiffnessAndDamping.
 		/// If mStiffness > 0 the constraint will be soft and mStiffness specifies the stiffness (k) in the spring equation F = -k * x - c * v for a linear or T = -k * theta - c * w for an angular spring.
 		/// If mStiffness <= 0, mDamping is ignored and the constraint will have hard limits (as hard as the time step / the number of velocity / position solver steps allows).
+		/// 
+		/// Note that stiffness values are large numbers. To calculate a ballpark value for the needed stiffness you can use:
+		/// force = stiffness * delta_spring_length = mass * gravity <=> stiffness = mass * gravity / delta_spring_length.
+		/// So if your object weighs 1500 kg and the spring compresses by 2 meters, you need a stiffness in the order of 1500 * 9.81 / 2 ~ 7500 N/m.
 		float					mStiffness;
 	};