I Have a Curve. It is 15 Secnods Long, the values are ranging from 0-1. I have a float called Health. I want to Regenerate the helath whenever I lose. get how much health I have left. I divide it by 100 so I get a value between 0-1. Using this value I want to get the time on the curve. So I can set the start time on the helath Regeneration time to that value. The timeline uses the same curve. I want a way to give my curve a value and than it gives me the time it found that value at. I see the Problem, there can be multiple times when thet value exists. So an other solution I am thinking about is “inverting” the curve. So that the time goes from 0 to 1 and the values from 0 to 15. How is that possible? I tried doing it manuel, but that is not very exact. Thank for helping me!
Yes you can do that but if your curve is only stright line and does not have repeated value
meaning say at time 0.1 value is 10 and again at 0.5 value is again 10
Your curve must be like image bellow:
Because, It may crash and its not optimised, I did it for Paragon distance matching system…
you need to write it yourself
get the cyrve key values then on a loop search for primary key(PKey) and SecondaryKey(SKey) such a way that the value is between thosk key value
then use this equation for time…
//For now use linear solve // create Time and value delta float dV = SKey.Value - PKey.Value; float dT = SKey.Time - PKey.Time; // Linear equation solve ReturnTime = ((dT / dV) * (InValue - PKey.Value)) + PKey.Time;
OK but you never show how it time is obtained from value?
You can create a second curve with swapped axis values. Let’s say you have one key whose properties is Time 2 and value 7, change them to Time 7 and Value 2, and do the same for all the keys. And then you can feed in the health value and get the time value that you can use in your first timeline.
Maybe there is a math function to inverse the curve automatically, but I couldn’t find any info on that.
Unfortunately there is no such function in 4.21.
and yes youy can do that way but it has 2 main problems
- You have to create 2 curves.
- In some cases value will not be the same.
So I did that way because I am working on Paragon distancematching system…