I would like for an character in my game to oscillate the color intensity, sort of pulsing. But i don’t see any way to create an action for this. I can create key frames in the timeline, but how to i turn those key frames into an action that i can apply to the object.
Unfortunately, object colors are impossible to change dynamically in BGE. However, you can change object colors by changing an object’s mesh, and having multiple hidden meshes to match different colors.
The best way to do this is through logic. You can set up logic to detect frames in a current action (by giving the action actuator an integer-type “frame” property and checking that property), and use logic to change an object mesh based on whichever frame the current action is on.
you can change color in game.
in material panel at options select object color.
now in object panel change the color, hit i on it to add a keyframe, and use it to do stuff with it.
in action actuator select the action of the cube and loop it or whatever.
example: change color with animation.blend (482 KB)
…WELP. I learned something today.
Keyframing materials and lights tends to eff up things for me. Luckily, there’s sweet python for everything.
VERY IMPORTANT NOTE: Remember to tick the "Object Color" box on the material properties option tab.
If you want something more complex I can probably cook up a script for that too, but I’ll need a more detailed explanation of what you want.
Thanks, works like a charm
tan sin??? seems like there would be a simple function to alter the color with a see saw effect changing from one color to another and reverting.
modulo tan…I don’t know I think I wrote a function like this when tinkering in unity…but I cannot seem to find it…I did not come up with the formula but I did adapt it to do something like this…I’m no wizard or anything.