Garry's Mod Wiki

Revision Difference

constraint.Weld#560645

<function name="Weld" parent="constraint" type="libraryfunc"> <description>Creates a weld constraint.</description> <realm>Server</realm> <file line="396-L461">lua/includes/modules/constraint.lua</file> <args> <arg name="ent1" type="Entity">The first entity</arg> <arg name="ent2" type="Entity">The second entity</arg> <arg name="bone1" type="number">The bonenumber of the first entity (0 for monoboned entities) ⤶ PhysObj number for ragdolls, see: <page>Entity:TranslateBoneToPhysBone</page>.</arg> <arg name="bone2" type="number">The bonenumber of the second entity</arg>⤶ <arg name="forcelimit" type="number" default="0">The amount of force appliable to the constraint before it will break (0 is never)</arg> <arg name="nocollide" type="boolean" default="false">Should ent1 be nocollided to ent2 via this constraint</arg>⤶ <arg name="deleteent1onbreak" type="boolean" default="false">If true, when ent2 is removed, ent1 will also be removed</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="forceLimit" type="number" default="0">The amount of force appliable to the constraint before it will break (0 is never)</arg>⤶ <arg name="noCollide" type="boolean" default="false">Should ent1 be nocollided to ent2 via this constraint</arg>⤶ <arg name="deleteEnt1OnBreak" type="boolean" default="false">If true, when ent2 is removed, ent1 will also be removed</arg>⤶ </args> <rets> <ret name="" type="Entity">constraint</ret> </rets> </function> <example> <description>Adapted from stools/thruster.lua</description> <code> function TOOL:LeftClick( trace ) /* Boilerplate stool code to extract ClientConVars to variables */ local thruster = MakeThruster( ply, model, Ang, trace.HitPos, key, key_bk, force, toggle, effect, damageable, soundname ) local weld = constraint.Weld( thruster, trace.Entity, 0, trace.PhysicsBone, 0, collision == 0, true ) -- If you remove the entity thrusters are welded to, the thruster is removed as well end </code> </example>