From 25a47d9af5b8493dc537a6a915a507ff96af25b5 Mon Sep 17 00:00:00 2001 From: Xevion Date: Thu, 28 May 2020 08:32:40 -0500 Subject: [PATCH] Move BoidControllerEditor.cs into Editor folder, Add BUGS.md --- BUGS.md | 19 +++++++++++++++++++ .../BoidControllerEditor.cs | 6 ++---- .../BoidControllerEditor.cs.meta | 0 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 BUGS.md rename Boids/Assets/{Scripts => Editor}/BoidControllerEditor.cs (98%) rename Boids/Assets/{Scripts => Editor}/BoidControllerEditor.cs.meta (100%) diff --git a/BUGS.md b/BUGS.md new file mode 100644 index 0000000..0997547 --- /dev/null +++ b/BUGS.md @@ -0,0 +1,19 @@ +# bugs + +A list of frustrating or curious bugs. + +- DrawCircle Function Draw on Incorrect Axis + - For a long period of time, I couldn't figure out why my DrawCircle function was only drawing a straight line. + I reworked the code, looked online and did everything I could to get the function working before I gave up. + A day later, I switched from 2D mode to Freecam mode, and I finally saw it. + The circle was drew aligned on the incorrect axis, causing it to appear as a single line. + The fix was was just swapping one argument with the next. `(x, 0, y) -> (x, y, 0)` +- OnCenteringVelocity applied at > 200x correct rate + - When I implemented `Time.deltaTime` based velocity calculations, I didn't correct the OnCenteringVelocity implementation. + This caused a strange behaviour that looked very similar to a incorrect boundary calculation. + I spent some time checking Boundary/Wrapping related code before I forgot it, as I hadn't modified it. + It didn't take that long, but I'm still surprised I caught it since the mistake is so small. + The error was that since the `Time.deltaTime` value is not multiplied (scaling the 1x multiplier down to 0.02x), + the velocity would speed it to an incredible speed for a single frame. + This would cause all edge wrapped boids to skip a certain distance to the center of the rectangle which looked like + an edge wrapping/boundary error. \ No newline at end of file diff --git a/Boids/Assets/Scripts/BoidControllerEditor.cs b/Boids/Assets/Editor/BoidControllerEditor.cs similarity index 98% rename from Boids/Assets/Scripts/BoidControllerEditor.cs rename to Boids/Assets/Editor/BoidControllerEditor.cs index e248ec5..c94d717 100644 --- a/Boids/Assets/Scripts/BoidControllerEditor.cs +++ b/Boids/Assets/Editor/BoidControllerEditor.cs @@ -1,5 +1,4 @@ -#if UNITY_EDITOR -using UnityEditor; +using UnityEditor; using UnityEngine; [CustomEditor(typeof(BoidController))] @@ -58,5 +57,4 @@ public class BoidControllerEditor : Editor { if (redraw) controller.focusedBoid.Draw(true); } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/Boids/Assets/Scripts/BoidControllerEditor.cs.meta b/Boids/Assets/Editor/BoidControllerEditor.cs.meta similarity index 100% rename from Boids/Assets/Scripts/BoidControllerEditor.cs.meta rename to Boids/Assets/Editor/BoidControllerEditor.cs.meta