Greetings Blender Artists.
I am pretty new to blender game engine, so my apologies if this post seems noob-ish
I have a script that will randomly generate a solar system, and all works well; however, I cannot find a way to create a random material for the planets and such. I have this function for actually making the material:
def makeMaterial(name,diffuse,specular,alpha):
mat=bpy.data.materials.new(name)
mat.diffuse_color=diffuse
mat.diffuse_shader='LAMBERT'
mat.diffuse_intensity=1.0
mat.specular_color=specular
mat.specular_shader='COOKTORR'
mat.specular_intensity=0.5
mat.alpha=alpha
mat.ambient=1
return mat
and then I go and make my material,
mat=makeMaterial('name',[uniform(0,1),uniform(0,1),uniform(0,1)],[uniform(0,1),uniform(0,1),uniform(0,1)],1)
which (i think) makes a good material with random colors and such. Unfortunately, I have no clue as to how to actually assign the material to the object I have. Any help is greatly appreciated, and thanks in advance.
-Collective2