Garry's Mod Wiki

Garry's Mod Wiki

  Entity constraint.Keepupright( Entity ent, Angle ang, number bone, number angularLimit )

Description

Creates a keep upright constraint.

Arguments

1 Entity ent
The entity to keep upright
2 Angle ang
The angle defined as "upright"
3 number bone
The bone of the entity to constrain (0 for boneless)
4 number angularLimit
Basically, the strength of the constraint. Must be above 0.

Returns

1 Entity
The created constraint, if any or false if the constraint failed to set

Example

Adds a console command that makes whatever prop the player is looking at to be kept upright.

concommand.Add( "keep_upright",function( ply, cmd, args ) local tr = ply:GetEyeTrace() local ent = tr.Entity if ( !IsValid( ent ) ) then return end constraint.Keepupright( ent, ent:GetAngles(), tr.PhysicsBone, 999999 ) 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 four times a day. Edits and history are not available.

Last Parsed: Loading...