- Home /
 
Light pulse
Hey. I want to add a pulse effect to my light. I have it working as it is using Math.pingpong, but I don't want the light to go all the way to 0, I would rather it go to a lower range, so there is still light there but not as much. Here is what I have so far:
 private const float PULSE_RANGE = 4.0f;
 private const float PULSE_SPEED = 3.0f;
 currentSpellLight.range = Mathf.PingPong(Time.time * PULSE_SPEED, PULSE_RANGE);
 
               So ideally I want the light to not turn off fully. How can I best do this? Thanks
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Radivarig · Apr 15, 2014 at 01:49 PM
 private const float PULSE_RANGE = 4.0f;
 private const float PULSE_SPEED = 3.0f;
  
 private const float PULSE_MINIMUM = 1.0f;
  
 currentSpellLight.range = PULSE_MINIMUM +
                           Mathf.PingPong(Time.time * PULSE_SPEED, 
                                          PULSE_RANGE - PULSE_MINIMUM);
 
               Radivarig
Your answer
 
             Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
How do I make a spotlight make a model play an animation? 2 Answers
Multiple Cars not working 1 Answer
How do i change speed of 2D animation 1 Answer
How to get the Quaternion Rotation from a Matrix4x4 2 Answers