Having troubles with "PhysObj:ApplyForceOffset" and custom entity
0 replies, posted
Having trouble with making vehicle hover with "ApplyForceOffset"
Actually I check distance between line start and line end(With trace) and then apply force from wheel position, and then it jumps like that(Look down for see GIF)
I need it for making suspension for car
Is there any ideas to fix that?
(code with aplpying force, if needed)
local vel = self:GetVelocity()
local dist = self:GetBonePosition(self:LookupBone(wh)):Distance(tr.HitPos) + vel.z
self.Wheels[wh.."_Lerp"] = !self.Wheels[wh.."_Lerp"] and 0 or Lerp(.01, self.Wheels[wh.."_Lerp"], (self.WheelRadius-dist)*2000)
print(self.Wheels[wh.."_Lerp"])
PhysObj:ApplyForceOffset( Vector(0,0,(self.Wheels[wh.."_Lerp"])), self:GetBonePosition(self:LookupBone(wh)) )
https://files.facepunch.com/forum/upload/175035/87736dca-2aff-4adf-b5d8-bd2070aa5ea3/a517ee9c98e07438416e90e8db4f7653.gif
Sorry, you need to Log In to post a reply to this thread.