constraint.Weld

From Garry's Mod
Jump to: navigation, search
 constraint.Weld( )

Contents

Description

Creates a weld constraint

Arguments

Entity ent1

The first entity

Arguments

Entity ent2

The second entity

Arguments

number bone1

The bonenumber of the first entity (0 for monoboned entities)

PhysObj number for ragdolls, see: Entity:TranslateBoneToPhysBone.

Arguments

number bone2

The bonenumber of the second entity

Arguments

number forcelimit

The amount of force appliable to the constraint before it will break (0 is never)

Arguments

boolean nocollide

Should ent1 be nocollided to ent2 via this constraint

Arguments

boolean deleteent1onbreak

If true, when ent2 is removed, ent1 will also be removed

Returns

Entity

constraint

Examples

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


Personal tools
Navigation