I’ve run into an issue that’s driving me insane, because I’ve read all of the questions on the matter, and although the answers seem to work for the other askers, they simply don’t for me. I have an int variable called “boostValue” that I am limiting to a minimum of 0 and a maximum of 300. I have another int variable called “barWidth”, which I need to limit to a minimum of 4 and a maximum of about 240, though I’m not set on the exact max value just yet. Now, I need the barWidth value to be set within its range to the equivalent of the boostValue within ITS range. I’ll also need to do this for a different int variable similar to barWidth, only I need it to be calculated to a negative value. Either way, I need both of them to be calculated (within their range) according to the current value of boostMeter (within its range). I’ve tried everything I can find, and everything I can think of, but the barWidth value either goes up by a TINY amount, or just stays at 0. By “tiny amount”, I mean I would have to set the boostValue to some ridiculously high number just to get the barWidth to something like 10. I’ve been messing around with this and trying different ideas for so long now, that I can hardly even remember everything the script has done that isn’t what I need. I can’t even tell if I’m on the right track anymore. I could be doing something completely different now and I don’t even realize it. This is so simple, but it just won’t work for me.
barWidth = Mathf.InverseLerp(4, 240, boostValue);
That’s the basis of what I need, though I’m not even sure how I would make it take into account the limits of the boostValue. If someone could please show me what I’m doing wrong here, and maybe show me how I could pull this off, I would be very grateful.