Skip to content

Commit a65435e

Browse files
committed
more physics part dampings
mainly for the push mode
1 parent 4fc588a commit a65435e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lua/pac3/core/client/parts/physics.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ BUILDER:StartStorableVars()
3838
:GetSet("MaxSpeedDamp", 1000)
3939
:GetSet("MaxAngularDamp", 1000)
4040
:GetSet("DampFactor", 1)
41+
:GetSet("DampFactorPost", 0)
42+
:GetSet("AngleDampFactorPost", 0)
4143
BUILDER:SetPropertyGroup("Speeds")
4244

4345
:GetSet("ConstantVelocity", Vector(0,0,0))
@@ -227,6 +229,14 @@ function PART:OnThink()
227229
phys:AddVelocity(0.5 * vec:GetNormalized() * extra_dist / math.Clamp(self.SecondsToArrive,0.05,10))
228230
end
229231
end
232+
if self.DampFactorPost ~= 0 then
233+
local vel = phys:GetVelocity()
234+
phys:SetVelocity((1 - self.DampFactorPost) * vel)
235+
end
236+
if self.AngleDampFactorPost ~= 0 then
237+
local angvel = phys:GetAngleVelocity()
238+
phys:SetAngleVelocity((1 - self.AngleDampFactorPost) * angvel)
239+
end
230240
else
231241
if self.ConstrainSphere ~= 0 then
232242
local offset = self.Parent:GetWorldPosition() - phys:GetPos()

0 commit comments

Comments
 (0)