Quantcast
Channel: Latest Questions by MithosAnnar
Viewing all articles
Browse latest Browse all 60

How do I Adjust The Colour Of My Object By Percentages?

$
0
0
Hello, and how *are* you? I'm trying (and very, very hard at that!) to change the colour of an object by picking up other objects, what are a certain colour. For example: If I was to pick up two red objects and a blue object I would want my object to be 2 parts red and 1 part blue. Here is the script i'm using. var red : float; var green : float; var blue : float; var purple : float; var orange : float; var playerColor : Material; function Start () { playerColor = renderer.material; } function Update () { red = red + purple / 2 + orange /3; green = green + orange /3; blue = blue + purple / 2 + orange /3; playerColor.SetColor("_Tint", Color(red, green, blue)); } function OnCollisionEnter (other : Collision) { if (other.transform.tag == "Particle") { other.gameObject.SendMessage("SendParticle"); Destroy (other.gameObject); } } function AddBlue () { blue ++; } function AddRed () { red ++; } function AddOrange () { orange ++; } function AddPurple () { purple ++; } function AddGreen () { green ++; } So yeah... It doesn't work. Maybe a tip or two (something...anything..) on how colour works? Thanks!

Viewing all articles
Browse latest Browse all 60

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>