That Lerp part makes no sense. Lerp is used to interpolate between two values. To have a fade the float argument at the en...

posted to: Adding Crosshairs
That Lerp part makes no sense. Lerp is used to interpolate between two values. To have a fade the float argument at the end needs to be animated from 0.0f to 1.0f. Giving 1.0f immediately set the color at the final value.
  • Jonathan Gonzalez(jgonzalez) replied
    I'm not sure what you're saying. The Color.lerp? We're going from white to red and vice versa using the fade variable set to 1.0f. What would be your suggestion otherwise?
  • krystman replied
    If you write Color.Lerp(Color.white, Color.red, 1.0f); that's the same as simply writing Color.red; The final parameter (1.0f) denotes the progress/position of the LERP, not the time or speed. So Color.Lerp(Color.white, Color.red, 0.5f); would return a color midway between white a red. If you you intended to made the color fade in that script, here is how it would work: http://pastebin.com/xQAfEwAR
  • Jonathan Gonzalez(jgonzalez) replied
    I see what you mean. Maybe "fadeTime" wasn't the best name for the variable but nonetheless the effect is what we are going for. Changing from white to red.
  • krystman replied
    Are you sure you are familiar with how that function works? There is no "effect". There is no animation. You just change the color instantly to a different one. The way it is set up the you can't make the transition gradual. The Lerp is completely superfluous. I don't understand why you have it there. I haven't seen the entire flow yet. Perhaps you do something with the Lerp later? I think you should have left the Lerp out and written crosshair.color = Color.white; and crosshair.color = Color.red; You do that below at the else part so you seem to be aware that this works. I worried the way it is right now is unnecessarily obtuse and misleading for newcomers.
  • Jonathan Gonzalez(jgonzalez) replied
    Yes I understand how it works. Is it entirely necessary to use Lerp? No, but it is one way to do it. We're going form one color to another. It's not misleading as it's still going to achieve the effect we want. The effect being white going to red and vice versa. This is what I mean by "effect". There are multiple ways of doing something and I like to show different ways of achieving something. I understand what you're saying. I think I've explained why I used it, and you've explained your reasoning as well. Lets not make this into a message board interaction, thanks.
  • krystman replied
    I guess we have to agree to disagree. Sorry about being so hardass about it. Keep it up!