This article's documentation is for anything that uses the Source engine. Click here for more information.

Phys constraintsystem: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(transfered description from Physics Entity Overview)
No edit summary
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{base_point}} If you have a collection of objects connected by [[:Category:Constraints|constraints]], the constraint solvers may fight each other as they are each solved without regard to each other. You'll see this as vibration or jiggling.
{{CD|CPhysConstraintSystem|file1=physconstraint.cpp}}
{{this is a|logical entity|name=phys_constraintsystem|engine=Source}} If you have a collection of objects connected by [[:Category:Constraints|constraints]], you may encounter vibration or jiggling. This is because each constraint is solved without regard for any others until you introduce a '''phys_constraintsystem'''.


To prevent this problem, you can create a phys_constraintsystem and have each object in a constraint group that group refer to it (by [[targetname]]) as their system manager. Those solvers will then be iterated as a group, which will create a feedback loop between the constraints so that interactions between them can be managed.
To implement a phys_constraintsystem create one and give it a name, then select the constraints you want to group together and set it as their "Constraint System Manager".


The constraint system also allows you to control the number of iterations, allowing you to allocate more CPU to get the solution tighter. This will help when objects of dissimilar mass are connected, as if a large-mass object is in violation of the constraint it will take more iterations for it to move to a non-violating position/orientation. [[Ragdoll]]s create a constraint system internally to solve these issues.
A constraintsystem also allows you to control the number of iterations performed on the constraints, allowing you to allocate more CPU to get the solution tighter. This will help when objects of dissimilar mass are connected, as if a large-mass object is in violation of the constraint it will take more iterations for it to move to a non-violating position/orientation. [[Ragdoll]]s create a constraint system internally to solve these issues.


== Keyvalues ==
== Keyvalues ==
{{KV Targetname}}
{{KV|Additional System Iterations|intn=additionaliterations|integer|Adding iterations makes the interactions among constraints in a system tighter. It will not compensate for errors due to collision, but will help in cases where objects of disparate mass are constrained to each other.}}


*'''additionaliterations''' <[[int]]>
[[Category:Constraints|C]]
:Adding iterations makes the interactions among constraints in a system tighter.  It will not compensate for errors due to collision, but will help in cases where objects of disparate mass are constrained to each other.
*{{KV Targetname}}
 
==Inputs==
*{{I Targetname}}
 
==Outputs==
*{{O Targetname}}
 
{{wrongtitle|title=phys_constraintsystem}}
[[Category:Constraints]]

Latest revision as of 06:23, 29 April 2025

C++ Class hierarchy
CPhysConstraintSystem
CLogicalEntity
CServerOnlyEntity
CBaseEntity
C++ physconstraint.cpp

phys_constraintsystem is a logical entity available in all Source Source games. If you have a collection of objects connected by constraints, you may encounter vibration or jiggling. This is because each constraint is solved without regard for any others until you introduce a phys_constraintsystem.

To implement a phys_constraintsystem create one and give it a name, then select the constraints you want to group together and set it as their "Constraint System Manager".

A constraintsystem also allows you to control the number of iterations performed on the constraints, allowing you to allocate more CPU to get the solution tighter. This will help when objects of dissimilar mass are connected, as if a large-mass object is in violation of the constraint it will take more iterations for it to move to a non-violating position/orientation. Ragdolls create a constraint system internally to solve these issues.

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Additional System Iterations (additionaliterations) <integer>
Adding iterations makes the interactions among constraints in a system tighter. It will not compensate for errors due to collision, but will help in cases where objects of disparate mass are constrained to each other.