Hello all,
I am working on a SWEP that I'd like to be able to spawn a series of individual props that are constrained to one another through ropes.
[CODE]
if SERVER then
if self.Owner:KeyDown(IN_USE) then
local water = ents.Create("prop_physics")
self.Ball = water
self.Ball:SetModel("models/hunter/misc/sphere075x075.mdl")
self.Ball:SetPos(self.Owner:GetShootPos()+(self.Owner:GetAimVector()*35))
self.Ball:SetAngles(self.Owner:EyeAngles(15) )
self.Ball:SetMaterial("models/effects/vol_light001")
self.Ball:SetPhysicsAttacker(self.Owner)
self.Ball:Spawn()
self.PhysBall = self.Ball:GetPhysicsObject()
self.Ball:EmitSound("ambient/water/wave2.wav")
self.PhysBall:SetMass(1000)
self.PhysBall:ApplyForceCenter(self.Owner:GetAimVector(1) * 25000000)
self.Ball:Fire("kill", "", 10)
self.PhysBall:EnableDrag(false)
local trail = util.SpriteTrail( water, 0, Color( 0, 0, 255, 255 ), false, 50, 250, 5, 1, 'effects/beam_generic01.vmt' )
end
end
if SERVER then
if self.Owner:KeyDown(IN_USE) then
local water = ents.Create("prop_physics")
self.Ball = water
self.Ball:SetModel("models/hunter/misc/sphere075x075.mdl")
self.Ball:SetPos(self.Owner:GetShootPos()+(self.Owner:GetAimVector()*40))
self.Ball:SetAngles(self.Owner:EyeAngles(15) )
self.Ball:SetMaterial("models/effects/vol_light001")
self.Ball:SetPhysicsAttacker(self.Owner)
self.Ball:Spawn()
self.PhysBall = self.Ball:GetPhysicsObject()
self.Ball:EmitSound("ambient/water/wave2.wav")
self.PhysBall:SetMass(1000)
self.PhysBall:ApplyForceCenter(self.Owner:GetAimVector(1) * 25000000)
self.Ball:Fire("kill", "", 10)
self.PhysBall:EnableDrag(false)
local trail = util.SpriteTrail( water, 0, Color( 0, 0, 255, 255 ), false, 50, 250, 5, 1, 'effects/beam_generic01.vmt' )
end
end
if SERVER then
if self.Owner:KeyDown(IN_USE) then
local water = ents.Create("prop_physics")
self.Ball = water
self.Ball:SetModel("models/hunter/misc/sphere075x075.mdl")
self.Ball:SetPos(self.Owner:GetShootPos()+(self.Owner:GetAimVector()*45))
self.Ball:SetAngles(self.Owner:EyeAngles(15) )
self.Ball:SetMaterial("models/effects/vol_light001")
self.Ball:SetPhysicsAttacker(self.Owner)
self.Ball:Spawn()
self.PhysBall = self.Ball:GetPhysicsObject()
self.Ball:EmitSound("ambient/water/wave2.wav")
self.PhysBall:SetMass(1000)
self.PhysBall:ApplyForceCenter(self.Owner:GetAimVector(1) * 25000000)
self.Ball:Fire("kill", "", 10)
self.PhysBall:EnableDrag(false)
local trail = util.SpriteTrail( water, 0, Color( 0, 0, 255, 255 ), false, 50, 250, 5, 1, 'effects/beam_generic01.vmt' )
end
end
end[/CODE]
This is what I have so far. I am currently drawing a blank as to how I'd be able to constrain them to one another, however.
I did get a look at this earlier but I am still trying to wrap my head around it -
[code]constraint.Rope( Entity Ent1, number Ent2, number Bone1, number Bone2, Vector LPos1, Vector LPos2, number length, number addlength, number forcelimit, number width, string material, boolean rigid )[/code]
Do I need to set this up for each prop individually (there are three but it looks like only two slots for entity names)? And by ent is it looking for what each prop is named?
I suppose in this instance I'm looking for how to properly apply the rope code? I have looked at it a bit and I'm still a tad stumped.
Sorry, you need to Log In to post a reply to this thread.