File tree 2 files changed +9
-4
lines changed
common/src/main/kotlin/org/valkyrienskies/eureka
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,14 @@ object EurekaConfig {
120
120
@JsonSchema(description = " How fast a ship will stop. 1 = fast stop, 0 = slow stop" )
121
121
var linearStabilizeMaxAntiVelocity = 1.0
122
122
123
+ // Instability scaled with mass and squared speed
124
+ @JsonSchema(description = " Stronger stabilization with higher mass, less at higher speeds." )
125
+ var scaledInstability = 1000.0
126
+
127
+ // Unscaled linear instability cased by speed
128
+ @JsonSchema(description = " Less stabilization at higher speed." )
129
+ var unscaledInstability = 0.271828
130
+
123
131
@JsonSchema(description = " How fast a ship will stop and accelerate." )
124
132
var linearMassScaling = 0.0002
125
133
Original file line number Diff line number Diff line change @@ -49,10 +49,7 @@ fun stabilize(
49
49
50
50
val speed = ship.poseVel.vel.length()
51
51
52
- val multiplierA = 1000f ; // 1 kilo
53
- val multiplierB = 0.271828 ; // e / 10
54
-
55
- stabilizationTorque.mul(EurekaConfig .SERVER .stabilizationTorqueConstant / max(1.0 , speed * speed * multiplierA / ship.inertia.shipMass + speed * multiplierB))
52
+ stabilizationTorque.mul(EurekaConfig .SERVER .stabilizationTorqueConstant / max(1.0 , speed * speed * EurekaConfig .SERVER .scaledInstability / ship.inertia.shipMass + speed * EurekaConfig .SERVER .unscaledInstability))
56
53
forces.applyInvariantTorque(stabilizationTorque)
57
54
58
55
if (linear) {
You can’t perform that action at this time.
0 commit comments