Skip to content

Commit 700bc98

Browse files
committed
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.
1 parent 29816ed commit 700bc98

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lua/entities/gmod_wire_thruster.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function ENT:SetForce( force, mul )
122122
end
123123

124124
if self.neteffect then
125-
self.effectforce = self.ThrustOffset:Length() * self.force * self.mul * 50
125+
self.effectforce = self.ThrustOffset:Length() * self.force * self.mul
126126
self.updateeffect = true
127127
end
128128

@@ -134,13 +134,13 @@ function ENT:SetForce( force, mul )
134134
end
135135

136136
function ENT:CalcForce(phys)
137-
local ThrusterWorldForce = phys:LocalToWorldVector( self.ThrustOffset ) * (self.force * self.mul * -50)
137+
local ThrusterWorldForce = phys:LocalToWorldVector( self.ThrustOffset ) * (self.force * -self.mul)
138138

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 )

lua/entities/gmod_wire_vectorthruster.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function ENT:CalcForce(phys)
165165
if ThrustLen>0 then
166166
local ThrustNormal = ThrusterWorldForce/ThrustLen
167167
self:SetNormal( -ThrustNormal )
168-
self.ForceLinear, self.ForceAngular = phys:CalculateVelocityOffset( ThrustNormal * ( math.min( self.force * self.mul, self.force_max ) * 50 ), phys:LocalToWorld( self.ThrustOffset ) )
168+
self.ForceLinear, self.ForceAngular = phys:CalculateVelocityOffset( ThrustNormal * ( math.min( self.force * self.mul, self.force_max ) ), phys:LocalToWorld( self.ThrustOffset ) )
169169

170170
self.ForceLinear = WireLib.clampForce(self.ForceLinear)
171171
self.ForceAngular = WireLib.clampForce(self.ForceAngular)

0 commit comments

Comments
 (0)