Question by
RogerGu · Aug 28, 2016 at 03:19 PM ·
particlesystemalpha
Smoke Opacity Relative to Player Health
I have a particle system emitting smoke. I am attempting to make the apparent thickness or darkness of the smoke relative to the health of the player. To do this, I am applying the relative vehicle damage (0 to 100) to the alpha of the particle system start color. Even when I divide the player damage by some number (6 is what the snipped below uses), the darkness of the smoke sees way beyond what I expect. For example, an alpha of 30 looks as dark as 255. Any thoughts? Better way to do this?
var smokeColor = smokeParticles.startColor;
float smokeAlpha = (255/100) * (vehicleDamage/6);
if (smokeAlpha > 255)
{
smokeAlpha = 255;
}
print("smoke alpha " + smokeAlpha.ToString());
var newcolor = new Color(smokeColor.r, smokeColor.g, smokeColor.b, smokeAlpha);
smokeParticles.startColor = newcolor;
Comment
Your answer