- Home /
Math question
Hello,
I've stumbled upon a question which I cannot answer with my basic high-school math skills. I've got this line of code:
    alertOMeter = Mathf.Lerp(alertOMeter, 100,2f*Time.deltaTime);
but now i want to increase the "Acceleration" when a certain float gets smaller:
 float distanceToPlayer = Vector3.Distance(transform.position, _player.transform.position);
It would be great if someone could help me with this!
Brum.
What is alertO$$anonymous$$eter supposed to be doing? What's its purpose? 
I think it's not really relevant for answering the question, but if you want to know. Its purpose is that when the meter is at 98 or more the enemy has realy spotted you. at the same time the color of the exclamation mark above its head changes:
 exclm.renderer.material.SetColor("_TintColor",Color.Lerp(exclm.renderer.material.GetColor("_TintColor"),Color.yellow,2f*Time.deltaTime));
here you see it uses the same increasing method. so whatever anyone will come up with, i'll use it there as well.
I hope this was enough?
Answer by GEWLAR · Oct 08, 2013 at 12:45 PM
You can dividend 1 by the float. I mean x=1/distanceToPlayer On this way your result gets bigger when the float gets smaller. Hope you understand what I mean. Sorry I'm not a native speaker.
Thank's man! i get what you meant, although I really had to crank up the "1" to get the effect I wanted. I'm also not a native speaker ;)
Your answer
 
 
             Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Trouble with Basic Math Formula for Deriving Velocity 1 Answer
Multiple Cars not working 1 Answer
How to detect if number has a decimal point or not 2 Answers
Minimap rotating nodes 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                