From 9356b058261cff4a5f9fd06564d9d7699461d7e9 Mon Sep 17 00:00:00 2001 From: ThatZeoMan <67521686+ThatZeoMan@users.noreply.github.com> Date: Wed, 17 Aug 2022 14:43:18 -0500 Subject: [PATCH] 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 --- Assets/Scripts/GameCamera.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Scripts/GameCamera.cs b/Assets/Scripts/GameCamera.cs index a87002cf3..3f98f1c54 100644 --- a/Assets/Scripts/GameCamera.cs +++ b/Assets/Scripts/GameCamera.cs @@ -170,7 +170,7 @@ namespace HeavenStudio EasingFunction.Function func = EasingFunction.GetEasingFunction(e.ease); float dx = func(positionLast.x, 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)