Phys lengthconstraint: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Boldened Inputs/Outputs)
m (Robot: fixing template case.)
Line 65: Line 65:


==Inputs==
==Inputs==
*{{i targetname}}
*{{I Targetname}}
*'''Break'''
*'''Break'''
:Force the constraint to break
:Force the constraint to break

Revision as of 19:34, 19 January 2009

Template:Wrongtitle Template:Base point

Entity Description

A constraint between two physically simulated objects, specifying the distance they should keep from each other. By default the link behaves like an invisible rope, and allows the objects to draw closer together, but it can be made rigid with its second spawnflag.

Tip.pngTip:This is the entity used to keep ropes under a certain length.

Usage

Lengthconstraint accepts two target entities:

  • Entity 1 (attach1) is anchored to the origin of the lengthconstraint itself
  • Entity 2 (attach2) is anchored to the helper (Attached object 2 point)

If one of the attach keyvalues is not specified, its respective end (i.e. the origin or the helper) will anchor to the world and never move.

Warning.pngWarning:There is not currently any way to control the amount of movement at attachment points. This results in an unrealistic wobble when a constraint is stretched without breaking.

Breaking

The lengthconstraint can be made to break through I/O or with a combination of the AddLength, ForceLimit and/or TorqueLimit keyvalues:

  • AddLength allows the constraint to go a certain number of units over or under its normal length before any forces are applied.
  • ForceLimit defines how much weight (in US pounds) can be put on a lengthconstraint before it breaks. 0 = infinite.
    • As well as the weight of whatever is attached to it, the further a lengthconstraint is stretched beyond its initial length (plus or minus the value in AddLength), the more that gets applied.
    • To hang a standard crate and allow the player to break its constraint by pulling, use a value of 1350.
  • TorqueLimit defines the 'weight' of twist that the lengthconstraint can have applied before breaking (in US pounds). 0 = infinite
    • Confusingly, torque is NOT calculated along the axis of the constraint, only perpendicularly! You can spin a lengthconstraint as much as you like; it will not break.
Tip.pngTip:Always specify a breaking sound. The crunchier the better!

See Also

Keyvalues

<vecline> Attached object 2 point - The position of the helper
  • attach1
<target_destination> Entity 1 - Entity that is anchored to the helper
  • attach2
<target_destination> Entity 2 - Entity that is anchored to the origin
  • constraintsystem
<target_destination> Constraint System Manager - The name of a phys_constraintsystem that this constraint should be a part of. All constraints on a set of entities should be placed in the same system, or they will fight each other during simulation.
  • forcelimit
<float> Force Limit to Break (lbs) - The amount of force an impact must apply to the constraint to break it. A way of calculating this is to set it to the mass of an object that would break this constraint if it were resting on the constrainted objects.
  • torquelimit
<float> Torque Limit to Break (lbs * distance)? - The amount of torque required to break the constraint. A way of calculating this is to multiply any reference mass by the resting distance (from the center of mass of the object) needed to break the constraint.
  • breaksound
Play Sound on Break - A sound played when the constraint is broken.
  • addlength
<float> Additional Length - Add (or subtract) this amount to the rest length of the rope.
  • minlength
<float> Minimum Length - If the constraint is not rigid, this is the minimum length it can be.

Flags

  • 1
No Collision until break (default on)
  • 2
Keep Rigid (default off)

Inputs

  • Break
Force the constraint to break
  • TurnOn
Enable the constraint. Do this when the objects don't exist when the constraint spawns - or when you have deactivated the constraint. Broken constraints can NOT be turned on. They have been deleted.
  • TurnOff
Disable this constraint.

Outputs

Fired when this constraint breaks.