Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local dir = pos - phys:GetPos() -- direction to the rod
- local len = dir:Length() / self.dt.length -- normalize the length
- len = len ^ 20 -- make it so length isn't linear
- dir:Normalize() -- normalize the dir so we can scale it properly back up
- -- apply the force offset from the hook
- phys:ApplyForceOffset(dir * (len * self.dt.length), phys:GetPos() + hook:GetUp() * 50)
- -- add some damping
- phys:AddAngleVelocity(phys:GetAngleVelocity() * -0.1)
- phys:AddVelocity(phys:GetVelocity() * -0.01)
Advertisement
Add Comment
Please, Sign In to add comment