Constraint: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(merge with Physics Entity Overview)
Tag: New redirect
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{toc-right}}
#Redirect [[Physics_Entity_Overview]]
 
A '''constraint''' is an [[entity]] that restricts the movement one or more [[VPhysics]] entities relative to the world or each other.
 
{{note|Constraints attach to a physics object's center of mass. To have them attach at specific points use [[info_constraint_anchor]].}}
 
{{tip|To constrain an object to the world, leave one of the target fields blank. The position of the constraint entity will then be used.}}
 
To constrain [[QPhysics]] objects, use [[parenting]].
 
== Simple constraints ==
; [[phys_constraint]]
: Prevents its targets from moving relative to each other.
; [[phys_lengthconstraint]]
: Limits how far its target(s) can move.
; [[phys_keepupright]]
: Tries to ensure that an object stays upright. Can look ''very'' wrong so use with care!
; [[phys_ballsocket]]
: Prevents movement but allows free rotation.
; [[phys_hinge]]
: Prevents movement but allows rotation along a single axis.
; [[phys_slideconstraint]]
: Restricts movement to a single axis.
 
==Complex constraints==
; [[phys_pulleyconstraint]]
: Essentially two length constraints with a shared length.
; [[phys_ragdollconstraint]]
: A ball socket with rotation limits.
; [[phys_spring]]
: A rigid length constraint with bounciness.
 
== Utilities ==
; [[phys_constraintsystem]]
: Manages a group of overlapping constraints and keeps them stable.
; [[info_constraint_anchor]]
: Used to attach constraints to a local position on an entity (usually they attach to the center of mass). Attach the desired constraint to this entity, and then [[parent]] this entity to the entity you want the constraint to apply to.
 
== See also ==
* [[VPhysics#Notable VPhysics entities]]
* [[Physics Entity Overview]]
* [[phys_thruster]]
* [[phys_torque]]
 
[[Category:Entities by topic]]

Latest revision as of 18:16, 8 June 2025