adjust screen shake behaviour

- fix bug with camera rotation easing
This commit is contained in:
minenice55 2022-08-19 16:48:55 -04:00
parent 1d8ef1fb1a
commit bc30fe5fd5
2 changed files with 12 additions and 24 deletions

View file

@ -148,8 +148,8 @@ namespace HeavenStudio
EasingFunction.Function func = EasingFunction.GetEasingFunction(e.ease); EasingFunction.Function func = EasingFunction.GetEasingFunction(e.ease);
float dx = func(rotEluerLast.x, e.valA, Mathf.Min(prog, 1f)); float dx = func(rotEluerLast.x, e.valA, Mathf.Min(prog, 1f));
float dy = func(rotEluerLast.y, e.valB, Mathf.Min(prog, 1f)); float dy = func(rotEluerLast.y, e.valB, Mathf.Min(prog, 1f));
float dz = func(rotEluerLast.z, e.valC, Mathf.Min(prog, 1f)); float dz = func(-rotEluerLast.z, e.valC, Mathf.Min(prog, 1f));
rotEluer = new Vector3(dx, dy, dz); rotEluer = new Vector3(dx, dy, dz); //I'm stupid and forgot to negate the rotation gfd 😢
} }
if (prog > 1f) if (prog > 1f)
@ -159,7 +159,6 @@ namespace HeavenStudio
} }
} }
//scren shake spaghetti
private void SetShakeIntensity() private void SetShakeIntensity()
{ {
foreach (var e in shakeEvents) foreach (var e in shakeEvents)
@ -167,11 +166,8 @@ namespace HeavenStudio
float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length); float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
if (prog >= 0f) if (prog >= 0f)
{ {
EasingFunction.Function func = EasingFunction.GetEasingFunction(e.ease); float fac = Mathf.Cos(Time.time * 80f) * 0.5f;
float dx = func(positionLast.x, e.valA, Mathf.Min(prog, 1f)); shakeResult = new Vector3(fac * e.valA, fac * e.valB);
float dy = func(positionLast.y, e.valA, Mathf.Min(prog, 1f));
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)
{ {

View file

@ -332,18 +332,7 @@ namespace HeavenStudio
new Param("ease", EasingFunction.Ease.Linear, "Ease") new Param("ease", EasingFunction.Ease.Linear, "Ease")
}, hidden: false ), }, hidden: false ),
new GameAction("screen shake", delegate new GameAction("move camera", delegate {}, 1f, true, new List<Param>()
{
//TODO: move cam
}, 1f, true, new List<Param>()
{
new Param("valA", new EntityTypes.Float(0, 10, 2), "Intensity")
} ),
new GameAction("move camera", delegate
{
//TODO: move cam
}, 1f, true, new List<Param>()
{ {
new Param("valA", new EntityTypes.Float(-50, 50, 0), "Right / Left"), new Param("valA", new EntityTypes.Float(-50, 50, 0), "Right / Left"),
new Param("valB", new EntityTypes.Float(-50, 50, 0), "Up / Down"), new Param("valB", new EntityTypes.Float(-50, 50, 0), "Up / Down"),
@ -351,10 +340,7 @@ namespace HeavenStudio
new Param("ease", EasingFunction.Ease.Linear, "Ease Type") new Param("ease", EasingFunction.Ease.Linear, "Ease Type")
} ), } ),
new GameAction("rotate camera", delegate new GameAction("rotate camera", delegate {}, 1f, true, new List<Param>()
{
//TODO: rot cam
}, 1f, true, new List<Param>()
{ {
new Param("valA", new EntityTypes.Integer(-360, 360, 0), "Pitch"), new Param("valA", new EntityTypes.Integer(-360, 360, 0), "Pitch"),
new Param("valB", new EntityTypes.Integer(-360, 360, 0), "Yaw"), new Param("valB", new EntityTypes.Integer(-360, 360, 0), "Yaw"),
@ -362,6 +348,12 @@ namespace HeavenStudio
new Param("ease", EasingFunction.Ease.Linear, "Ease Type") new Param("ease", EasingFunction.Ease.Linear, "Ease Type")
} ), } ),
new GameAction("screen shake", delegate {}, 1f, true, new List<Param>()
{
new Param("valA", new EntityTypes.Float(0, 10, 0), "Horizontal Intensity"),
new Param("valB", new EntityTypes.Float(0, 10, 1), "Vertical Intensity")
} ),
new GameAction("display textbox", delegate new GameAction("display textbox", delegate
{ {
}, 1f, true, new List<Param>() }, 1f, true, new List<Param>()