I originally posted this as a bug report here (https://answers.unrealengine.com/que…-expected.html) but there are some subtle nuances with the Sequencer Attach track/sections behaviour that warrants detailed discussion.
So the interesting conundrum surrounding this issue is related to the When Finished property on Attach track sections. After some more digging I came across this page in the docs (https://docs.unrealengine.com/latest…hed/index.html) which helped to clarify the intended behaviour of the When Finished property but funny enough both When Finished options (Keep State and Restore State) feels as if it conflicts with the expected behaviour of an attach track. Allow me to clarify:
When Finished == Restore State
According to the documentation, this returns the actor to its pre-animated state, which works. When the section ends the actor gets detached (following the detachment rules) but immediately gets restored to its original pre-animation position.
When Finished == Keep State
According to the documentation, the current state of the actor (in sequencer) should be preserved. This is indeed the case, with the side effect that the actor never gets detached, which is expected … sort of.
So, in neither of the above When Finished cases does the Attach track actually do what is says on the tin. I can’t attach an actor and detach it a little while later whilst preserving its world space position:
The Keep State behaviour is the closest thing to what I’m looking for here. Now my question is, what is an acceptable way to “fix” this behaviour? Would it be acceptable to detach the actor while enforcing the detach rules with “When Finished == Keep State”?
I have submitted a pull-request (against latest Master branch) for a fix for the attach track behaviour here: https://github.com/EpicGames/UnrealEngine/pull/4101
Here is a video illustrating the new behaviour:
Just some notes / caveats for interested parties:
- In order for the attach track to observe the attach / detach rules, the “When Finished” property has to be set to “Keep State”. If this property is set to “Restore State” the component/actor’s original state will be restored.
- Due to some odd transform update/caching behaviour in Sequencer (or lack thereof), there has to be at least 2 frames of pre-roll prior to the first attach section, otherwise the “original state” of the component can’t be captured correctly. I’m not sure whether there is a workaround that can be employed directly in the Attach template itself – that remains to be seen.
- DO NOT add a transform track to the actor that is being attached. This will just deliver all sorts of transform havoc.
hey [USER=“718531”]Van Aarde[/USER] thanks a lot for this. Unfortunately I can’t get the object to dettach with Keep State on. I’ve read through your comments and can’t quite find out how to do it. Any thoughts?
I’m currently investigating this. It turns out that the attach track is storing the pre-animated transform state and restoring it. This conflicts with the Attach / Detach Rules. I’ve changed it locally so that it no longer stores that transform state in the attach track. So, the behavior looks like this:
Cylinder attached to center of cube. When scrubbing outside of the attached region, the cylinder stays put because the Attach / Detach Rules are set to World. Notice, the hierarchy changing when scrubbing inside/outside the attach region.
Is that what you would expect?
That’s looking pretty good! That is indeed what I would expect. Nice one, thanks!
@Max.Chen - This is broken still/again in UE 4.26.2 – is there a fix in sight?
Like the comment from July 2019, detach doesn’t work with Keep State On. I duplicated your YouTube video setup, and it doesn’t work. Using Restore State, the actors will attach and detach properly, but it creates huge translational jumps at the transition points. Relative or World makes no difference.
Looking forward to your help on this. Thanks.
Hi @Max.Chen , are there any plans on fixing this issue?