❔ Values
New to C#, trying to get a value that continuously returns different numbers until it reaches a maximum or minimum number. How can I do that?
13 Replies
What does 'get a value' mean?
Whatever that is, put it in a loop, with break condition(s) being the min/max val
like im trying to get a number
Yes, what does get mean?
From where?
im sorry im horrible at explaining things
so like
im playing a game and Im making a script for it
the script is for the wheels
the wheels have a friction setting that can be changed on the fly by script
and im trying to get the number to change smoothly
back and forth
So you're just wanting a small constant increment each time then
ye
So you're asking how to do the maths?
ye
(max -min)/(points-1)
0->3 in 4 steps:
(3-0) / (4-1) = 1 (step size)
Loop from 0 to 3 (4 steps)0 + 0*1 0 + 1 *1 0 + 2 * 1 0 + 3*1
John French
Game Dev Beginner
The right way to Lerp in Unity (with examples) - Game Dev Beginner
Learn to animate buttons, move objects and fade anything - the right way - in my in-depth guide to using LERP in Unity (including copy / paste examples).
if you're using unity
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.