C
C#2y ago
>_ott0

❔ 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
phaseshift
phaseshift2y ago
What does 'get a value' mean? Whatever that is, put it in a loop, with break condition(s) being the min/max val
>_ott0
>_ott0OP2y ago
like im trying to get a number
phaseshift
phaseshift2y ago
Yes, what does get mean? From where?
>_ott0
>_ott0OP2y ago
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
>_ott0
>_ott0OP2y ago
phaseshift
phaseshift2y ago
So you're just wanting a small constant increment each time then
>_ott0
>_ott0OP2y ago
ye
phaseshift
phaseshift2y ago
So you're asking how to do the maths?
>_ott0
>_ott0OP2y ago
ye
phaseshift
phaseshift2y ago
(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
Anton
Anton2y ago
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).
Anton
Anton2y ago
if you're using unity
Accord
Accord2y ago
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.
Want results from more Discord servers?
Add your server