how can I change the materials in real time

There is a script or something that I can do to change the materials in real time, for example, I have a house and I want to the walls to change from black to white when I press “C” key, and “puff” the color changed.
I really need this for a client, and I dont know how to make it.

Well the easiest way to do it, is to have a duplicate of the model with a different texture aplied, and then use the change mesh actuator.

The other way, if you only need the colors to change, animate the RGB value of the material and add a property to object as color changer, and play IPO for that property, let’s say with the arrow keys.
For textures, maybe use replace mesh…
Have a look…


Color changer.blend (296 KB)

good, but there is something to make it with some script?
If i want to change jsut the color of the material, there is a way to make it using ipo? because when I tryed this it doesnt work.( you just answer my question I saw it after i post the reply torakunsama)
Thanks torakunsama
Thanks IAmThisGuy

torukunsama, there is a way to make it smotly?, like i press up and the color smotly changes form grey to red for example?

Of course, it all depends on how you animate your RGB values.


smooth color change.blend (127 KB)

Thanks a lot, for the help, if you guys need something just ask i ll be happy to help you!