Skip to content

Commit 7e6f499

Browse files
Small optimization of thruster force calculation (#3482)
* Remove the arbitrary 50x multiplier for the force input. It doesn't explain anywhere that it multiplies the force by 50. This hurts making precise forces unless you know to divide the force by 50. Even then it multiplies it after the check for the maximum force. On the regular thruster I removed some unnecessary WorldToLocalVectors to just apply the force globally instead of locally since we already have it global. I have tested it in game and it works for me. * Revert some changes * Revert more --------- Co-authored-by: Astralcircle <[email protected]>
1 parent fe00bb9 commit 7e6f499

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lua/entities/gmod_wire_thruster.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ function ENT:CalcForce(phys)
139139
-- Calculate the velocity
140140
local ForceLinear, ForceAngular = phys:CalculateVelocityOffset(ThrusterWorldForce, phys:LocalToWorld( self.ThrustOffset ))
141141

142-
self.ForceLinear = phys:WorldToLocalVector(WireLib.clampForce(ForceLinear))
143-
self.ForceAngular = phys:WorldToLocalVector(WireLib.clampForce(ForceAngular))
142+
self.ForceLinear = WireLib.clampForce(ForceLinear)
143+
self.ForceAngular = WireLib.clampForce(ForceAngular)
144144
end
145145

146146
function ENT:SetDatEffect(uwater, owater, uweffect, oweffect)
@@ -241,7 +241,7 @@ function ENT:PhysicsSimulate( phys, deltatime )
241241

242242
self:CalcForce(phys)
243243

244-
return self.ForceAngular, self.ForceLinear, SIM_LOCAL_ACCELERATION
244+
return self.ForceAngular, self.ForceLinear, SIM_GLOBAL_ACCELERATION
245245
end
246246

247247
function ENT:Switch( on, mul )

0 commit comments

Comments
 (0)