fully functional screen shake

its a lil smooth at lower intensities but it works! lots of "complicated" "math" going on here.
thanks for all the help, minenice!

recommended settings -
intensity: 2
length: 0.25
This commit is contained in:
ThatZeoMan 2022-08-17 14:43:18 -05:00
parent a46b747898
commit 9356b05826

View file

@ -170,7 +170,7 @@ namespace HeavenStudio
EasingFunction.Function func = EasingFunction.GetEasingFunction(e.ease); EasingFunction.Function func = EasingFunction.GetEasingFunction(e.ease);
float dx = func(positionLast.x, e.valA, Mathf.Min(prog, 1f)); float dx = func(positionLast.x, e.valA, Mathf.Min(prog, 1f));
float dy = func(positionLast.y, e.valA, Mathf.Min(prog, 1f)); float dy = func(positionLast.y, e.valA, Mathf.Min(prog, 1f));
shakeResult = new Vector3(Mathf.Sin(dx * 3.14159265f * 5f) * e.valA, Mathf.Sin(dy * 3.14159265f * 10f) * e.valA); shakeResult = new Vector3(Mathf.Cos(dx * e.length * 20f) * (e.valA / 2), Mathf.Cos(dy * e.length * 30f) * (e.valA / 2));
} }
if (prog > 1f) if (prog > 1f)