Garry's Mod Wiki

Garry's Mod Wiki

  Entity constraint.Weld( Entity ent1, Entity ent2, number bone1, number bone2, number forceLimit = 0, boolean noCollide = false, boolean deleteEnt1OnBreak = false )

Description

Creates a weld constraint.

Arguments

1 Entity ent1
The first entity
2 Entity ent2
The second entity
3 number bone1
PhysObj number of first entity to constrain to. (0 for non-ragdolls).

See Entity:TranslateBoneToPhysBone.

4 number bone2
PhysObj number of second entity to constrain to. (0 for non-ragdolls).

See Entity:TranslateBoneToPhysBone.

5 number forceLimit = 0
The amount of force appliable to the constraint before it will break (0 is never)
6 boolean noCollide = false
Should ent1 be nocollided to ent2 via this constraint
7 boolean deleteEnt1OnBreak = false
If true, when ent2 is removed, ent1 will also be removed

Returns

1 Entity
The crated constraint entity. (phys_constraint)

Example

Adapted from stools/thruster.lua

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

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...