Created
December 26, 2016 20:46
-
-
Save luke161/f09f2d58f4e7c5fd0464514f6c211311 to your computer and use it in GitHub Desktop.
Function for generating a triangle wave between -1 and 1 in Unity C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static float TriangleWave(float x) | |
{ | |
return UnityEngine.Mathf.Abs((x%4)-2)-1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment