My postcount and the fact that most here have no idea who I am, proofs that I am not really into the BGE
I thought I poke around a bit in it, and it seems I am unable to find how to animate a material color, or it’s transparency for that matter.
I tried with a pure material without texture, animate the color as action and add an Action Actuator but that ain’t working.
I tried it with a texture and face textures and the RGB to Intensity color and an Action Actuator, but it ain’t working either.
The old 2.49 tutorials suggest it works, I just can’t figure it out for 2.6.
Any help apreciated.
I thought this problem trivial, yet a lot of views and no answers.
I see a few options:
- Does really no one know how to do it?
- Not possible in 2.6?
- Is this one of those question where you’d need hours to explain because I am already approaching it wrong?
What I am trying to achieve is to make a simple fire.
Got a nice “particle” texture already. Got an emitter too randomly emitting the “particle”, and the particle even shrinks on it’s way, however I want to change the color of the “particle” from a bright yellow, obviously to a dark red, and also change it’s opacity.
As soon as I key the color or the opacity, the “particle” just keeps the color that was keyed last, although the f-curve clearly works.
Can you use a node based material – with two material inputs and a mix node, and animate the mix-node influence?
It is very easy:
set up an material action as you would do for render (e.g. with material tab).
Any sensor (e.g. keyboard) -> AND -> Action actuator with your material action start/end frame and an appropriate play mode.
Transparency needs a bit more, as you need to explicit enable transparency (it is expensive when rendering):
- Game Settings/Alpha blend: Alpha Sort (optional: disable Backface Culling)
- Transparency: Select Z-Transparency set keyframes for Alpha
Material Alpha is visible in Texture mode only!
Material Alpha is not visible in Preview. Texture Alpha is visible in Preview.
Monster’s method will only work in Multitexture mode. If you want to do it in GLSL, you have to change the color with an f-curve and enable “Object Color” under options in the materials tab. Then you can play the f-curve action like Monster said. If you feel like messing with Python, you can also change object color with a script.
Ah yeh, using GLSL mode, forgot to mention that. I’ll look into it further today JFF
I messed up with the Material settings and using an seperate image as alpha channel for the fake particle.
Made a quick’n’dirty scene to share for those intrested.
Texures are packed in LQ 256px, the diffuse floor’s from cgtextures.com, the rest’s from me, feel free to do whatever you want with them or it. CC-0