I have an object that has to change the redness of itself from green to red on the basis of a variable like health! You might have seen in games where our health becomes more reddish from greenish when out health decreases! How do I do that?? I tried once but it didnt change the colour!! I did like this:
The color values are red;green;blue.
If you want to go from green to red, start with green = 255, red = 0 and adjust values until green = 0 and red =255.
You don’t need to change blue.
Create a text object on the scene to display your color calculations. That way, you can check if your code works as expected (0->255;255->0;0->0).
You need to figure out the calculation depending on your variable.
There is no change in colour!!
Your reply was not helpful! Maybe help after looking this! Oh It is not properly closed !! So but this works neither why???
That is an interesting way saying “I don’t know what is wrong and I don’t understand you, could you please explain it why is this not working?”
Dude, if you don’t know something do not pretend you do because we know you don’t, otherwise you would not ask bull
Leave the horses and your high minded attitude at home and start at the ground.
You should learn more about syntax and the difference between a numerical value, and a text value.
It is because of your lack of knowledge in this area that what you do does not work.
Yeah sure.
Variable(green) return a number value but you are trying to use it as a string, you wan to convert the value to string first using the ToString() expression that you can find in the expression editor that Gruk mentioned and then apply in the value field of the color as Bouh told you.
Everything is explained on the wiki and you can find all the expressions in the expression editor but as I can see from the screenshot, you can’t even use the search on the wiki
Are you asking how to search or what?
Yet you behave like some sort of general expecting results on command. That’s not the way to ask for help. If you need further help, try to change your attitude maybe.
Yes, you need double quotes BUT.
If Red = 0 (Numerical)
When you call a variable this way VariablesString(Red) will return “0” (String)
Because VariablesString() Returns the value as String. Variable() Returns the value as Numerical.
; is a color separator, it must be type String. + is for concatenated values, add this betweens String or Numerical values
I lock this topic during 1 day, you need try to understand thes responses, read the wiki page and test the differents type of values.
When you need help please be more friendly in next responses…