Download

Sequencer Attach Tracks

Jun 8, 2021.Knowledge

When authoring a sequence it can be useful to take advantage of Unreal’s attachment system, but there are times when attachments cannot be created prior to the sequence, for example with Spawnables, or if there is some temporal element to when the attachment should be made.

Instead of scripting the attachment of objects, Sequencer provides Attach Tracks, which will automate the attaching and detaching, using the same mechanism (USceneComponent::AttachToComponent).

In the simple case where the sequence does not animate the object’s transform, this works as expected. We offer attachment and detachment rules for the sections so users can control how the object’s position is affected.

Attachment Rules have three options:

  • Keep Relative (defaut): The new parent’s transform is treated as the origin for the existing transform. For locations, this moves the object, but keeps it offset from the parent (the transforms are added together).
  • Keep World: The object being attached will have its transform recalculated so that its relative transform to its parent will put it into the same world space as before the attachment. For locations, this keeps the object in the same spot.
  • Snap to Target: The object will inherit the transform of its new parent. For locations, this will move the object to the new parent.

These can be applied to Locations, Rotations, and Scales separately.

Detachment Rules have two options:

  • Keep Relative (default): The world origin will be treated as the origin for the existing relative transform. If you had Keep Relative for attachment, this will undo that, so for locations, this would move the object back to its original world location (the parent’s transform is subtracted out again).
  • Keep World: The object’s world transform will be recalculated so that the object stays in the same place.

However, when the sequence animates the transform of an object, the two systems will be working against each other, and these rules will not work as intended, since both are setting the object’s transform.

The transform section will directly animate the object’s transform, and the attachment will change the coordinate space of that transform. Without counter-animating that coordinate space shift, the transform section will not appear correct.

We have support for automatically counter-animating the transform when adding an attach track. These are accessed from the add menu and have these attach options available:

  • Preserve Current: Adds a key to the transform section corresponding to the start of the attach track, which will preserve the world space position of the object.
  • Preserve All: Adds keys for every key in the parent object’s transform, to preserve the worldspace throughout the entire attachment. Will also modify existing keys to preserve any animation already on the child object.
  • Preserve with Bake: Bakes out keys each frame to preserve the worldspace transform and animations of the child object.
  • None (default): Does not add any keys when adding a new attach track.

image

You can manually author your sequences to avoid this as well. If you set up the attach track, then animate the transform, you will be animating while already taking the attachment into account.

One strategy is having a different transform section for the duration of the attachment. This will let you animate the transform throughout the sequence, and have a separate transform section tailored specifically for the attachment.

Another strategy is to set-up the attachment and then bake it into a transform, to avoid the systems from conflicting with each other. Once you have a combined animation you’re happy with, you can bake the transform from the Actions menu (wrench icon) in the Sequencer toolbar. You will need to have the binding selected.

1 Like

Thanks @Rudy_Triplett

Do we have any method to limit the axes used in Sequencer? eg Attach X & Y only (no Z) [eg bool or float multiplier per axis]

I also noticed that the attach rules generally don’t take into account Socket locations (animated bones) eg “Trim Right and Preserve” sets the child’s Transform back to the parent’s component world coordinates without offsetting the current location of its selected socket/bone.