Guides:Constraint dampening: Difference between revisions

From VRChat Wiki
jetdog8808 (talk | contribs)
mention fps also affecting speed.
Hackebein (talk | contribs)
Add more details
Line 1: Line 1:
{{Noticebox/Community}}
{{Noticebox/Community}}
{{Stub|Not much information here! You can [[VRCWiki:How to Contribute|contribute]] by expanding, and proofreading this article, in accordance with the [[VRCWiki:Manual of Style|Manual of Style]].}}
{{Stub|Not much information here! You can [[VRCWiki:How to Contribute|contribute]] by expanding, and proofreading this article, in accordance with the [[VRCWiki:Manual of Style|Manual of Style]].}}
Constraint dampening or self referencing constraints, is a way to gradually have a constraint follow a source transform instead of snapping to it. This is mainly used on avatars, but can be used in worlds as well. Main constraint types used are Parent, Position, Rotation, and Scale constraints.[[File:Constraint_dampening_example.gif|border]]
 
[[File:Constraint_dampening_example.gif|border]]
Constraint dampening, or self-referencing constraints, allows a constraint to follow its source gradually instead of snapping instantly. It’s most commonly used on avatars, but works in worlds too. The main constraint types are Parent, Position, Rotation, and Scale constraints. Keep weight% of source. 0 (0%) is an instant update to target, 0.2 (20%) - 0.3 (30%) is a good value to smooth out network updates.
 
The speed toward the target depends on:
* Current distance to the target (larger gap ⇒ faster)
* Frame rate (more frames per second ⇒ faster)
* Damp weight (lower damp ⇒ faster)


== Setup ==
== Setup ==
=== Manual ===
[[File:Constraint dampening editor.webp|thumb|Editor setup example]]
[[File:Constraint dampening editor.webp|thumb|Editor setup example]]
To setup add the Gameobject that the constraint is on to one of the sources for your constraint, and have its weight set to 1. The other sources will be what you want the constraint to move towards.


The speed depends on the FPS and the weight of the other sources. The higher the FPS or weight the faster it will move, and lower FPS or weight will move it slower.  
1. Add the GameObject with the constraint as one of the sources in the Constraint component, and set its weight to 1. 
2. Use a second source for the target position
 
=== Automated ===
The [[VRChat Package Manager|VPM package]] from [[Community:VRLabs|VRLabs]] automates this process. After adding it to your hierarchy, unpack the package and move the target object to its desired position.
 
* [https://github.com/VRLabs/Damping-Constraints/blob/main/README.md Project Page] at github.com
 


==Official resources==
==Resources==
* [https://docs.unity3d.com/Packages/com.unity.animation.rigging@1.3/manual/constraints/DampedTransform.html| 'Damped Transform | Animation Rigging'] on ''docs.unity3d.com''
* [https://docs.unity3d.com/Packages/com.unity.animation.rigging@1.3/manual/constraints/DampedTransform.html 'Damped Transform | Animation Rigging'] on ''docs.unity3d.com''


[[Category:Guides]]
[[Category:Guides]]

Revision as of 01:34, 30 April 2025

V · ECommunity-written content
The following was created by the community. It may contain material not directly endorsed by the VRChat team. To learn more, consider reading Contributing to the VRChat Wiki.
V · EThis page is a stub.
You can help the VRChat Wiki by improving it.
[Reason: Not much information here! You can contribute by expanding, and proofreading this article, in accordance with the Manual of Style.]

Constraint dampening, or self-referencing constraints, allows a constraint to follow its source gradually instead of snapping instantly. It’s most commonly used on avatars, but works in worlds too. The main constraint types are Parent, Position, Rotation, and Scale constraints. Keep weight% of source. 0 (0%) is an instant update to target, 0.2 (20%) - 0.3 (30%) is a good value to smooth out network updates.

The speed toward the target depends on:

  • Current distance to the target (larger gap ⇒ faster)
  • Frame rate (more frames per second ⇒ faster)
  • Damp weight (lower damp ⇒ faster)

Setup

Manual

Editor setup example

1. Add the GameObject with the constraint as one of the sources in the Constraint component, and set its weight to 1. 2. Use a second source for the target position

Automated

The VPM package from VRLabs automates this process. After adding it to your hierarchy, unpack the package and move the target object to its desired position.


Resources