Can a rope be attached to a player or weapon?

Hello there.

So, lately I’ve been trying to create a fishing rod SWEP. The SWEP creates/removes a “Bait” with the Primary Attack (depending if it’s created or not) and I was trying to attach the bait to the fishing rod with a rope, but I can’t seem to get it right.

Any help?

Yes you can but you should not.
If you want bait to follow SWEP use
PhysObj:ComputeShadowControl( table shadowparams ) in ENTITY:PhysicsSimulate() hook

This is how original Fishing SWEP does this:


function ENT:PhysicsSimulate( phys, deltatime )


	if not IsValid(self.point) then return end
	local pos = self.point:GetPos()
	local shadow_params = {}
	shadow_params.secondstoarrive = 0.005
	shadow_params.pos = pos // Target position
	shadow_params.angle = Angle(0,0,0) // Target angles
	shadow_params.maxangular = 500000000000000000
	shadow_params.maxangulardamp = 1000000000000000
	shadow_params.maxspeed = 1000000000000000
	shadow_params.maxspeeddamp = 1000000000
	shadow_params.dampfactor = 0.9
	shadow_params.teleportdistance = 200
	shadow_params.deltatime = deltatime

	phys:ComputeShadowControl( shadow_params )


That “you shouldn’t” means that the code is unstable, right? Is there any other way?

I might try this one.

Maybe you can try creating a seperate entity for your fishing rod (ie. it’s spawned internally, whilst having your actual (SWEP:SetModel(string)) model empty), and create a constrain with that entity.

If you already have a good viewmodel, you can disable the rod’s rendering on the owner’s client if you’re smart, and you can use the worldmodel as previously intended.

You could just do what TTT does for the magneto stick, or as it’s known in the code… weapon_zm_carry.