From 480506b715ab343c84877c984386a70f5418aedc Mon Sep 17 00:00:00 2001 From: spatialfree Date: Sat, 23 Nov 2024 17:45:53 -0500 Subject: [PATCH] box_shake on box hole --- Platforms/Android/AndroidManifest.xml | 4 ++-- src/Arts.cs | 9 ++++++++- src/Mono.cs | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Platforms/Android/AndroidManifest.xml b/Platforms/Android/AndroidManifest.xml index 3492e74..e2903f5 100644 --- a/Platforms/Android/AndroidManifest.xml +++ b/Platforms/Android/AndroidManifest.xml @@ -2,8 +2,8 @@ diff --git a/src/Arts.cs b/src/Arts.cs index 3a918fb..c4b7167 100644 --- a/src/Arts.cs +++ b/src/Arts.cs @@ -15,6 +15,8 @@ static class Arts static Material mat_justcolor = new Material("justcolor.hlsl"); static Tex tex_box = Tex.FromFile("paper.jpg"); + + public static Vec3 box_shake = new(0, 0, 0); static Quat food_ori = Quat.Identity; static XYZi last_headpos = new(0, 0, 0); @@ -71,9 +73,14 @@ static class Arts ); // box + box_shake = Vec3.Lerp(box_shake, Vec3.Zero, Time.Stepf / 0.333f); // scale in float box_scale = Mono.box_scale; // Maths.min(Maths.smooth_stop(Maths.u_scalar(Time.Totalf - 3)) * Mono.box_scale, Mono.box_scale); - Hierarchy.Push(Mono.box_pose.ToMatrix(box_scale)); + Hierarchy.Push(Matrix.TRS( + Mono.box_pose.position + (box_shake * U.cm * 0.333f), + Mono.box_pose.orientation, + box_scale + )); // meshes["InsideOut"].Draw(mat_unlit, Matrix.Identity); meshes["InsideOut"].Draw( mat_box, diff --git a/src/Mono.cs b/src/Mono.cs index 0fe2582..a3ed9ad 100644 --- a/src/Mono.cs +++ b/src/Mono.cs @@ -176,6 +176,7 @@ static class Mono { holes.Add(snake[0], snake_dir); SFX.punch_through.PlayBox(snake[0]); + Arts.box_shake += snake_dir.ToVec3; } if (holes.ContainsKey(snake[snake_len - 1])) {