How do you get the elastic and rope constraints to work on the player entity?
4 replies, posted
I am trying to attach a rope or a elastic rope to a player to limit what direction they can go, but it is refusing to actually stop the player. I can simply keep on walking like their is nothing attached to me.
Here is the code I tried:
[lua]
local trace = self.Owner:GetEyeTrace().HitPos
local ent = self.Owner:GetEyeTrace().Entity
if ent:IsPlayer() or ent:IsNPC() then
constraint.Elastic(self.Owner, ent, 0,0, Vector(0,0,0), Vector(0,0,0), 500, 3, 0.01, "cable/rope",1, false )
end
[/lua]
Are you sure that you can constraint players? I would use another entity and parent the player to this entity
[QUOTE=gonzalolog;45410909]Are you sure that you can constraint players? I would use another entity and parent the player to this entity[/QUOTE]
I tried that but it didn't work either.
[lua]
local prop = ents.Create("prop_physics")
prop:SetModel("models/props_junk/PlasticCrate01a.mdl")
prop:SetPos( self.Owner:GetPos() + Vector(0,0,120) )
prop:Spawn()
//prop:Wake()
prop:Activate()
local props = ents.Create("prop_physics")
props:SetModel("models/props_junk/PlasticCrate01a.mdl")
props:SetPos( ent:GetPos() + Vector(0,0,120) )
props:Spawn()
//props:Wake()
props:Activate()
prop:SetParent( self.Owner, -1 )
props:SetParent( ent, -1 )
//constraint.Rope( self.Owner, ent, 0,0, Vector(0,0,0), Vector(0,0,0), 0,0, 0, 1, "cable/rope", false )
constraint.Elastic( prop, props, 130,0, Vector(0,0,0), Vector(0,0,0), 500, 3, 0.01, "cable/rope",1, false )
[/lua]
Yeah I have never seen a constraint used on a player.
If it's not possible, you could do a hacky method to mimic the effects of it though.
[QUOTE=Jeezy;45412781]Yeah I have never seen a constraint used on a player.
If it's not possible, you could do a hacky method to mimic the effects of it though.[/QUOTE]
What do you mean like roping the player and checking if they get to far from the entity they are roped too?
Sorry, you need to Log In to post a reply to this thread.