diff --git a/Assets/JSon Tool/index.html b/Assets/JSon Tool/index.html
new file mode 100644
index 0000000..9a70e11
--- /dev/null
+++ b/Assets/JSon Tool/index.html
@@ -0,0 +1,381 @@
+
+
+
+
+
+ JSON Question Creator
+
+
+
+
+
+
+
+
+

+
Question Creator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Assets/JSon Tool/iwm_logo.svg b/Assets/JSon Tool/iwm_logo.svg
new file mode 100644
index 0000000..50b73da
--- /dev/null
+++ b/Assets/JSon Tool/iwm_logo.svg
@@ -0,0 +1,43 @@
+
+
+
+
\ No newline at end of file
diff --git a/Assets/Scripts/GateSpawner.cs b/Assets/Scripts/GateSpawner.cs
index 2666fa6..d4d90c9 100644
--- a/Assets/Scripts/GateSpawner.cs
+++ b/Assets/Scripts/GateSpawner.cs
@@ -63,6 +63,7 @@ public class GateSpawner : MonoBehaviour
public System.Action OnTutorialQuestionAnswered;
public System.Action OnTutorialSequenceFinished;
+
private void Awake()
{
// Fragebild initial aus
@@ -455,10 +456,10 @@ public class GateSpawner : MonoBehaviour
}
- // === Hilfen ===
+ // === Positionierung des SafetyTriggers > triggert falls Spieler durch kein Gate gefahren ist. Gilt als inkorrekte Antwort. ===
private void PlaceSkipTrigger(Transform basis, Vector3 fwd, Vector3 right)
{
- // Finde weitestes Gate (entlang fwd)
+ // === 1) Find farthest gate along 'fwd' ===
float maxAlong = float.NegativeInfinity;
Vector3 farthestPos = Vector3.zero;
@@ -474,27 +475,51 @@ public class GateSpawner : MonoBehaviour
}
}
+ // === 2) Pick trigger position a bit after farthest gate ===
Vector3 triggerPos = farthestPos + fwd * skipTriggerOffset;
- triggerPos = SnapToGround(triggerPos, fallbackGroundY);
+
+ // Height: use ship height if available, otherwise ground
+ float shipY = player ? player.position.y : fallbackGroundY;
+ triggerPos.y = shipY;
if (activeSkipTrigger != null) { Destroy(activeSkipTrigger); activeSkipTrigger = null; }
-
activeSkipTrigger = new GameObject("Safety Trigger");
- activeSkipTrigger.layer = gameObject.layer;
+
+ // === 3) Safe layer that collides with the ship ===
+ int layer = LayerMask.NameToLayer("Default");
+ activeSkipTrigger.layer = layer;
+
activeSkipTrigger.transform.position = triggerPos;
activeSkipTrigger.transform.rotation = Quaternion.LookRotation(fwd, Vector3.up);
var box = activeSkipTrigger.AddComponent();
box.isTrigger = true;
- box.size = new Vector3(skipTriggerSize.x, skipTriggerSize.y, skipTriggerThickness);
+
+ // === 4) Size it to cover the whole road (and then some) ===
+ float roadWidth = roadHalfWidth * 2f;
+ float lateralMargin = 300f; // catch off-road flyers
+ float height = 120f; // tall enough regardless of altitude
+ float thickness = Mathf.Max(skipTriggerThickness, 50f); // thick band
+
+ box.size = new Vector3(roadWidth + lateralMargin * 2f, height, thickness);
+
+ // Center vertically on ship height
+ box.center = Vector3.zero; // since we set transform.y to shipY already
var rb = activeSkipTrigger.AddComponent();
rb.isKinematic = true; rb.useGravity = false;
var logic = activeSkipTrigger.AddComponent();
logic.spawner = this;
+
+ // Optional: visual gizmo for sanity (editor only)
+#if UNITY_EDITOR
+ Debug.Log($"[GateSpawner] Safety Trigger @ {triggerPos} size {box.size}");
+#endif
}
+
+
private Vector3 SnapToGround(Vector3 pos, float fallbackY)
{
if (groundLayer.value != 0)
diff --git a/Assets/Scripts/SafetyTrigger.cs b/Assets/Scripts/SafetyTrigger.cs
index 2dc10a4..3403c0f 100644
--- a/Assets/Scripts/SafetyTrigger.cs
+++ b/Assets/Scripts/SafetyTrigger.cs
@@ -1,14 +1,23 @@
// SafetyTrigger.cs
-// Zweck: Sicherheits-Netz: wenn Spieler alle Gates überspringt, wird „falsch“ gezählt und weitergemacht.
using UnityEngine;
public class SafetyTrigger : MonoBehaviour
{
+ [SerializeField] private string playerTag = "Player";
public GateSpawner spawner;
private void OnTriggerEnter(Collider other)
{
- if (!other.CompareTag("Player")) return;
+ // Robust root detection (matches GateAnswer approach)
+ Transform root = other.attachedRigidbody
+ ? other.attachedRigidbody.transform
+ : other.transform.root;
+
+ if (!root.CompareTag(playerTag)) return;
+
+ // Uncomment while debugging:
+ // Debug.Log($"[SafetyTrigger] Hit by {root.name} (tag {root.tag})");
+
spawner?.HandleGateAnswered(false);
}
}