Can you animate vertex colors?

If so, how? Thanks for your time.

TorQ

yes you can… just look in the ipo window, then select (click on the word) ColR, ColG, ColB and then left click in the window to draw the curves…

ColA is the alpha value…

All these values range from 0 - 1

hope this helps, have fun

Carl

I’m checking it out now…

-This is a python script which can animate vertex colors.

from math import *
cont = GameLogic.getCurrentController()
me = cont.getOwner()

mesh = me.getMesh()
vi = mesh.getVertexArrayLength(0)

for id in range (0,vi):
vcol = mesh.getVertex(0,id).getRGBA()
#print vcol
vcol = …your code…
mesh.getVertex(0,id).setRGBA(vcol)

-in the part of script …your code… you can put a function
which changes color how you want.The problem is that the color is a long.
It changes from -1(white) to -(16**6)(black).

Ben

Ben,

Could you explain a little more or give an example of the “…your code” section of this script? thanks.

TorQ

-In this game:

http://members.xoom.virgilio.it/glabro1/MountainRace.zip

there are two scripts(InTheDark and InTheSun) which add and subtract a
value of the vertex colors of the main car.So when it goes inthe tunnel becomes darker .As regarding to the color value it’s ,as I told in the other messagge, a long integer.You need a table of colors in hex format(the same used for the html code and convert it in decimal)