Dynamic Crosshair in Widget with smooth transition

Hi,

Whenever I shoot with the shotgun, my dynamic crosshair is adding a small portion to the respective renter transform and scale of the crosshair elements in the HUD. After a retriggerable delay, the crosshair gets reset to its initial position without any problems. However, I would like to make the transition back to normal smoother and not just a plain jump.

Since timelines are not working in widgets, what other options do I have?

  • Create the timeline in another BP and send the results on tick back to the HUD?
  • Use the FInterp to. But I can’t get my head around the delta seconds. It is still jumping back to its initial position without any transition.

Any help is appreciated!

Can you show your code for the finterp?

With interp, you need to constantly sample the current position, but keep the target constant. The delta seconds just comes from the tick node.

thx for your interest. I have the following chain in the widget:

and inside the function, it starts with this for each of the 4 XHair elements (inner vs. outer, left vs. right). It is not connected as it wasn’t working properly

You mean I should bind the function on event tick? In this case, the performance drain will outbalance the benefits of having a dynamic xhair… Could I use a pausable timer or something that runs slower than tick and can be disabled if not needed?

thx for trying to help!

Interp nodes need to be called on tick. I suspect you don’t have tick calling this function?

There are timelines in widgets, they just don’t use curves, but are key-based instead. You can create smooth animations in widgets directly.

Hmm, there’s indeed the option to see keys as a curve, you’re right. I’ve never really deepened into widget animations, so I never noticed it. That’s nice.

There are timelines in widgets, they
just don’t use curves

Do you mean loading external curves? Because widget timelines have always had curves. There are also Triggers and Repeaters, bottom of the post:

This makes the widget animations system work pretty much the same as a Timeline. Repeater fires as often as the TL’s update. And Triggers produce events.

THX for the nice discussion. The “work-around” with get animation current time and a lerp is insane! Wouldn’t have come up with something like this in years.