so i have an object i want to change color for each increment of temperature increased of an object
my object starts with initTemp of 33f and has a limitTemp of 40f. when the temp reach limit of 40f, the color will turn red to value of 1. so heres the code that i think supposed to work :
but what happens is when i pressed space key, the color of the object suddenly turned red (value 1).
what im trying to do is by using the divider when my initTemp is equal to limitTemp then the value would be equal to 1 so it would turns red gradually.
is there something wrong with my coding and how to fix it?
,i have this program to change color gradually over time, so i made a code to make sure each iteration increase of temp would gain increase in RGB color Red. with initTemp as 33f and limitTemp as 40f
here is my code :
as you can see the value of initTemp/limitTemp is below 1 so i think theres nothing wrong with the code, but when i press space to increase the temperature suddenly my object turns red (value 1).
can anybody tell me how to fix it?
If initTemp starts with a value of 33f and limit Temp with a value of 40f then divider in your first update should be 0.83 or something like this - > this is why it’s almost completely red when you press space.
Make a debug.Log of the divider to try to find a better way to handle the color gradient.