AI Command Lab // Flight Simulator
300A: The Radar Sweep
Initial AI Output (Fragile)
// AI-Generated Code: Audit Failure (No Filter)
void Update() {
// Audit Fail: This ray will hit the Player's own Collider!
if (Physics.Raycast(transform.position, Vector3.down, 1.1f)) {
canJump = true;
}
}
Initial AI Prompt
"You ask the AI: "Check if the player is standing on the ground so they can jump.""
Pilot Comm Link
Mission Objective: A skilled Navigator directs the AI to use LayerMasks and Debug Lines.
Optimized Protocol
// Navigator Code: Precise & Visual
public LayerMask groundLayer; // Set this in the Inspector
void Update() {
float checkDistance = 1.1f;
bool isGrounded = Physics.Raycast(transform.position, Vector3.down, checkDistance, groundLayer);
// Always draw your radar path for the ground crew
Debug.DrawRay(transform.position, Vector3.down * checkDistance, isGrounded ? Color.green : Color.red);
if (isGrounded) canJump = true;
}