Working with locks

From Valve Developer Community
Revision as of 18:40, 4 November 2016 by Bombcartographer (talk | contribs) (Spelling)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Locks in the SFM are similar to parenting in other 3D animation tools, but they work a little differently. You can use locks to put a hat on a character or keep a camera on a character's face. A lock parents any 3D object onto any other 3D object in the scene.

Unlike in traditional 3D parenting, however, adding a lock does not change an object's existing animation; a hand locked to a wheelbarrow will not move with the wheelbarrow if it didn't before. What locking does is parent one object to another but also create counter-animation to maintain the animation relationships as they were. Then, you can remove or work with that counter-animation to make objects that are locked together also move together.

Also unlike in traditional 3D parenting, you can remove a lock after you have used it to adjust your animation, and the animation will be unaffected; the effects of having locked the objects together persist even after you remove the lock itself.

You lock and unlock objects in the Animation Set Editor. To the left of each object and each control for each object in the Animation Set Editor, there's a small lock box. That lock box indicates the object's or control's lock state.

To lock a control to the world:

  • In the Animation Set Editor, click the control's lock box. The lock box will change to a padlock icon.

To lock one control to another:

  • In the Animation Set Editor, drag the parent control onto the child control's lock box. The lock box will change to a padlock icon.

To lock a camera to a moving character's head:

  1. Select your shot.
  2. Position the scene camera so it frames the character's face.
  3. In the Animation Set Editor, drag the control for the character's head onto the scene camera's lock box.
Note.png Note: Even though the two objects are now locked together, if you preview the existing animation, you'll see that nothing has changed yet, because of the locked camera's new counter-animation. However, if you move the character's head around in the viewport, the camera will now track the movement.


Counter-animation is the original animation of the locked object. When an object is locked to a parent, the parent's movement samples are displayed in the Motion Editor, however, the locked objects counter-animation prevents it from following the parent. It must be confirmed by sliding the Default, Playhead, or Zero slider (under the Procedural tab) to full to override the counter-animation. Position and rotation of the locked object can be isolated in this manner. For example, the object can be locked to its parent's rotation but not it's position if so desired.

The Default slider applies the lock's position and/or rotation relative to the world. The Playhead slider applies the lock relative to the locked bone itself. Zero locks to the bone without changes (all Team Fortress 2 hats and cosmetics use this).

To remove the counter-animation of a locked object:

  1. Select the locked object in the Animation Set Editor.
  2. Go into the Motion Editor.
  3. Select the region of time you want affected, or select all of time (Ctrl+A).
  4. Drag the playhead until the locked object is in a state you like.
  5. On the Procedural tab, drag the Default preset all the way up.
  6. Preview your animation. The motion of the child object is now synchronized with the motion of the parent object.
Note.png Note: You can also partially remove the counter-animation by dragging the Default preset only partway, which will blend the locked object's original animation with the animation of its new parent.

See also