Garry's Mod Wiki

Revision Difference

constraint.Winch#560660

<function name="Winch" parent="constraint" type="libraryfunc"> <description>Creates a Winch constraint.</description> <description>Creates a winch constraint, a player controllable <page>constraint.Elastic</page>, allowing gradually increasing or decreasing the length.</description> <realm>Server</realm> <file line="1265-L1330">lua/includes/modules/constraint.lua</file> <args> <arg name="pl" type="Player">The player that will be used to call <page>numpad.OnDown</page> and <page>numpad.OnUp</page>.</arg> <arg name="Ent1" type="Entity">First entity.</arg> <arg name="Ent2" type="Entity">Second entity.</arg> <arg name="Bone1" type="number">Bone of first entity (0 for non-ragdolls),</arg>⤶ <arg name="Bone2" type="number">Bone of second entity (0 for non-ragdolls).</arg> <arg name="LPos1" type="Vector"></arg>⤶ <arg name="LPos2" type="Vector"></arg>⤶ <arg name="player" type="Player">The player that will be used to call <page>numpad.OnDown</page> and <page>numpad.OnUp</page>.</arg> <arg name="ent1" type="Entity">First entity.</arg> <arg name="ent2" type="Entity">Second entity.</arg> <arg name="bone1" type="number"><page>PhysObj</page> number of first entity to constrain to. (0 for non-ragdolls).⤶ ⤶ See <page>Entity:TranslateBoneToPhysBone</page>.</arg> <arg name="bone2" type="number"><page>PhysObj</page> number of second entity to constrain to. (0 for non-ragdolls).⤶ ⤶ See <page>Entity:TranslateBoneToPhysBone</page>.</arg>⤶ <arg name="localPos1" type="Vector">Position relative to the the first physics object to constrain to.</arg>⤶ <arg name="localPos2" type="Vector">Position relative to the the second physics object to constrain to.</arg>⤶ <arg name="width" type="number">The width of the rope.</arg> <arg name="fwd_bind" type="number">The key binding for "forward", corresponding to an <page>Enums/KEY</page></arg> <arg name="bwd_bind" type="number">The key binding for "backwards", corresponding to an <page>Enums/KEY</page></arg> <arg name="fwd_speed" type="number">Forward speed.</arg> <arg name="bwd_speed" type="number">Backwards speed.</arg> <arg name="material" type="string">The material of the rope.</arg> <arg name="fwdBind" type="number">The key binding for "forward", corresponding to an <page>Enums/KEY</page></arg> <arg name="bwdBind" type="number">The key binding for "backwards", corresponding to an <page>Enums/KEY</page></arg> <arg name="fwdSpeed" type="number">Forward speed.</arg> <arg name="bwdSpeed" type="number">Backwards speed.</arg> <arg name="material" type="string" default="">The material of the rope. If unset, will be solid black.</arg> <arg name="toggle" type="boolean" default="false">Whether the winch should be on toggle.</arg> <arg name="color" type="table" default="color_white">The color of the rope. See <page>Global.Color</page>.</arg> </args> <rets> <ret name="" type="Entity">Constraint. Can return nil. Will return false if the constraint could not be created.</ret> <ret name="" type="Entity">rope. Will return nil if the constraint could not be created.</ret> <ret name="" type="Entity">controller. Can return nil.</ret> <ret name="" type="Entity">The created constraint. ([phys_spring](https://developer.valvesoftware.com/wiki/Phys_spring)) Can return `nil`. Will return `false` if the constraint could not be created.</ret> <ret name="" type="Entity">The crated rope. ([keyframe_rope](https://developer.valvesoftware.com/wiki/Keyframe_rope)) Will return `nil` if the constraint could not be created.</ret> <ret name="" type="Entity">The winch controller. (`gmod_winch_controller`) Can return `nil`.</ret> </rets> </function>