constraint.Rope

From GMod Wiki

Jump to: navigation, search
Function
Syntax constraint.Rope( Entity Ent1, Entity Ent2, Number Bone1, Number Bone2, Vector LPos1, Vector LPos2, Number length, Number addlength, Number forcelimit, Number width, String material, Boolean rigid )
Where is this used?
Description:
Creates a rope constraint.
Returns: Entity constraint, Entity rope
Part of Library: Constraint
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Constraint.Rope]Constraint.Rope [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionTaken from the Rope tool in toolgun.
Used onNewerServer.png
Code
 
// Get client's CVars
local forcelimit = self:GetClientNumber( "forcelimit" )
local addlength	 = self:GetClientNumber( "addlength" )
local material 	 = self:GetClientInfo( "material" )
local width 	 = self:GetClientNumber( "width" ) 
local rigid	 	= self:GetClientNumber( "rigid" ) == 1
 
// Get information we're about to use
local Ent1,  Ent2  = self:GetEnt(1),	 self:GetEnt(2)
local Bone1, Bone2 = self:GetBone(1),	 self:GetBone(2)
local WPos1, WPos2 = self:GetPos(1),	 self:GetPos(2)
local LPos1, LPos2 = self:GetLocalPos(1),self:GetLocalPos(2)
local length = ( WPos1 - WPos2):Length()
 
local constraint, rope = constraint.Rope( Ent1, Ent2, Bone1, Bone2, LPos1, LPos2, length, addlength, forcelimit, width, material, rigid )
 
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox