CPhysConstraint

From Source Entities
Jump to navigation Jump to search
You may be looking for CPhysFixed.

CPhysConstraint is a base class for all physics constraint entities. These entities are used to simulate complex physical systems like pulleys and ball sockets.

Flags[edit | edit source]

  • 1: No Collision until break - While the constraint is active, the affected entities will not be solid.
  • 4: Start inactive
  • 8: Change mass to keep stable attachment to world - For phys_hinge only.
  • 16: Do not connect entities until turned on - Starts the connection off, and if either of the objects moves before the constraint gets turned on, they will consider their current locations relative to each other as where they should be once the constraint turns on. If not set, objects will snap back to the positions they were relative to each other in Hammer.

Keyvalues[edit | edit source]

Entity 1 (attach1) <target_destination>
First entity to attach.
Entity 2 (attach2) <target_destination>
Second entity to attach. Leave blank to attach Entity 1 to the world.
Constraint System Manager (constraintsystem) <target_destination>
Name of a phys_constraintsystem that this constraint is a part of. Sometimes this is necessary to keep constraint entities from fighting with each other.
Force Limit to Break (lbs) (forcelimit) <float>
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 constrained objects.
Torque Limit to Break (lbs * distance) (torquelimit) <float>
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.
Play Sound on Break (breaksound) <sound>
A sound played when the constraint is broken.
Follow teleport distance (teleportfollowdistance) <float>
If either of the constrained objects teleports more than this distance away, the other object will be teleported with it.

Inputs[edit | edit source]

Break
Breaks the constraint. Note: Broken constraints cannot be reactivated; they've been deleted.
TurnOn
Turns on the constraint. Note: The constrained objects may move wildly (but semi-naturally) once this input is sent.
TurnOff
Turns off the constraint. The objects will move around as they normally would, unless they're constrained otherwise.
ConstraintBroken (Not in FGD)
Same as Break.

Outputs[edit | edit source]

OnBreak
Fires when the constraint is broken.