Download

Setting Leave Tangent Value is Wrong: SequencerScripting

I can’t tell if this is a bug or an intended use case.

In the Sequencer Scripting plugin there is a way to set the arrive and leave tangents on float keys. I’ve been trying to leverage this functionality to import an export keys with tangent control included.

If you look in the module for the Curve Editor you will find that the code converts pixel space to seconds as an offset from where the bezier control handle was on BeginDrag() and then setting the pixel space to seconds offset as the value for the tangent. This value is tan(y/x) or just plainly y/x. Meaning that if f Y/X is 1, the angle of that bezier handle from the key origin is 45 degrees. Easy.

The MovieSceneScripting module contains a blueprint library that will supposedly let you set all the abstract data of a float key. It also explicitly says in the @param InNewValue Represents the geometric tangents in the form of “tan(y/x)” where y is the key’s value and x is the seconds (both relative to key). But a readout of this value is always some astronomically small float value. You cant even go past 0.9 before your angle is clamped at 90 degrees.

You should be able to input 1.0 to this function and have the tangent angle be 45 degrees. Is this a bug or how are we supposed to compute the tangent?

Btw setting the tangent weight works as intended. it’s always weight = sqrt(y^2+x^2)

The function in question Set Leave Tangent | Unreal Engine Documentation

I have submitted a bug report to Epic but here is the solution or anyone wondering.

While the tooltip is partially correct in saying Y/X is the tangent value. It must then also be multiplied by the TimeInterval of the sequencer. In this case that is your tick resolution.

0.000042 for 24000fps
0.000008 for 120000fps

So for the function SetArriveTangetn() SetLeaveTangent() the input should be

DesiredYCoord/DesiredXCoord * TimeInterval

Where X and Y are relative to the key. The key is the origin (0,0) for every key.

Viola!