I’m working on a SWEP, and I’m trying to figure out how to make a rope between the player and a physics prop.
Here’s part of my code:
if SERVER then
local ent = ents.Create("ropetank")
ent:SetPos(self.Owner:GetShootPos())
ent:SetAngles(Vector(1,0,0))
ent:Spawn()
local phys = ent:GetPhysicsObject()
phys:SetVelocity(self.Owner:GetAimVector() * 1000)
phys:AddAngleVelocity(Vector(math.random(-1000,1000),math.random(-1000,1000),math.random(-1000,1000)))
self.Owner:RemoveAmmo(1,self.Primary.Ammo)
if self.Owner:GetAmmoCount(self.Primary.Ammo) > 0 then
self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
end
end
So I need to make an elastic rope between the player and the ropetank entity. Can somebody tell me how to do this?