Notifications
Clear all

[Closed] Random colors point3

[size=1][size=2]I have a color picker used to set the Diffuse of a selected object .but I not sure how I go about making my point3 value “cour” a random number .heres a very cut down biy of my code can someone tell me how it should be done , I get an error whenI run with what I have so far .
Thanks for reading[/size]
[/size]

 on onColour changed onColour do (cour = onColour) 
 
if rando.checked do ( 
ranred = random 0 255 
rangre = random 0 255 
ranblu = random 0 255 
cour.x = ranred 
cour.y = rangre 
cour.z = ranblu 
) 
meditMaterials[24].materialList[noteval].Diffuse = cour 
 
 
 

2 Replies

What is the reason behind picking a color from a color picker and then changing it to a random color?

Just assign a random color straight to the color channel of the material:


 meditMaterials[24].materialList[noteval].Diffuse = if rando.checked then 
  random black white
 else
  cour
 

ok thanks I did not think of that