Change colour in-game [solved]

Hey!

  • What’s the best way to change a colour in-game? (lets say [1, 0.5, 0] (orange))
    I know how to get a vertice of an object, and change the colour that way, but is there a better, cleaner way?

  • Also, how can I change the color of an object’s texture for only that object?

Thanks in advance!
-Pret_Letter

You can use a Ipo curves, select the object, open the Ipo curve editor and and add curves for Col R, Col G Col B and Col A. You will need to make a frame for each colour you want to use though.
Then just use an Ipo actuator to set which colour (frame) to use.

But then you change the material, and I only want to change the colour of 1 object…
But thanks tho’ :slight_smile:

You don’t change the materials, but I think you can’t use materials or it doesn’t work?

Not the material Ipo but the actual object Ipo, there is col r, col g, col b and col a (alpha) there.

I added a blend to demonsrate, you can add a texture to the object and the ipo will change the hue of the texture.

Attachments

col_ipo.blend (129 KB)

Cool! See if I can put that in my Color Picker

Thanks! :slight_smile:

I added a “ColA” as well to animate the alpha but it does not seem to have any effect. Are there any special settings needed to make the alpha work?

I think that you need to set the alpha on (edit panel, texture map)
I’ll try it :slight_smile:

Yep, that did it :slight_smile:
Is there a way to set the Col via Python?
(mesh.setColR or something :wink: )

Thank you, Pret_Letter. Can you post a screen shot (or .blend)? I can’t find the setting you are referring to.

Select the cube in edit-mode, press U and select reset.
Then press F9 and find the Texture Face panel (in face select mode). Select Alpha for every face (just copy the settings to al faces) and it should work :slight_smile:

Not sure if there is a way like you suggested but you can with an IPO that is driven by a property. See the attached .blend for an example.

Attachments

colourIpoDriver.blend (121 KB)

Yeah, that could work, but with this method you can’t change the R, G and B independently