Hello, I just want to smooth the rotation of the needle when its rotate, I think I’m missing something
here i can’t seems to find it. i know about lerp and timeline but i cloud not understand the how to get the rotation of the needle ( start - end ) to be in lerp ( A - B ).
I would actually suggest a timeline here. Play from start as the input, when you open up the timeline (double click) add a Float value and make two keys with value of 0 and 1. For the 0 value key, place it at time 0 as well. Figure out how long you want the movement to take, and place the key with value of 1 at that time.
Go back out to the event graph, and on the float output of the timeline, plug that into a LERP as the alpha. (0 value = A, 1 value = B). For the A and B use “Old health %” as A and “New health %” as B.
And there you go! Let us know if you need any additional walking through!
Also, as a bonus, you can right click the keys in the Timeline to add curve to the value so it can move faster or slower as different times.
Well, when the player takes damage, before applying the damage you get “Health / Max health” which will be a %. That’s your “Old Health” (A), so save that float.
Then, you have the player take the damage or healing.
Upon taking the damage or heal, you have a new health value. So you do “Health / Max Health” again. That’s your “New Health” (B).
At the end of the event, run the Timeline and LERP I talked about, with A being “Old Health” and B being “New Health”. The timeline will run it’s course changing from A to B values. That goes into the “Alpha” on the LERP (this creates the slide effect).
The output on the lerp goes to the “Set Relative Rotation” Y like you have above, attached to the “Update” output on the Timeline, but instead of setting it instantly it should change between point A (before getting hit/healed) and point B (after getting hit/healed) gradually- the speed of which is governed by your timeline’s final Key.
Timeline and interpolate, u could also use event tick instead of timeline if you think it’s worth it. I mean it’s real simple, you just finterp current needle rotation to the target needle rotation.