changing vertex colors in game engine

just wondering…

is it possible to change the vertex colors of a mesh through python scripting in the game engine???

w.

yep, its possible, just say specifically what you want done i can do it.

You don’t need python to do it. You can use ColR, G, and B in the object IPOs.

Pooba

thanx for responding so fast…

in a scene i am adding a bunch of objects in random positions (a python script resets an empty to a certain position and then the addObject actuator is activated). I am able to make a list of the objects added through a getLastCreatedObject and an append command. What i would like to do is change the color of a certain added object from white to a random color when it collides with the user…and back to white again.

Hope this makes things more clear…

w.

First: with IPOs you can’t change your colour to a random colour. Just to colours specified by your IPOs.
Draw your IPOs for RGB in object IPOs (changing from white to your colour and back) and create IPO actuator, which plays your IPO. This actuator can be fired by any controller a sensor.

Acually, it’s very easy to set it to a random color. Just make an ipo frame of each color, then use a int uniform random acuator to set a random value on a property called “frame” or soemthing, then use an ipo acuator with a play property iwth frame as the property.

Pooba

Sorry, Pooba, what do you mean by “make an ipo frame of each color”? I assume random colour means any possible colour. So in this case your IPO should be veeery long. Or I just misunderstood something.

whoever said you can do it without python was wrong. randomness is easy. setting the colour of each individual vertex involves geting the particular vertex and setting its colour.

this is explained if you search for the post “sugestion to those who want almost perfect skyboxes” and read the replies.

-Luke

however it is possible to use IPOs to change the colour of the whole object

Thanx about all your replies :smiley: