public void RadarCam() { Vector3 dir = ap.GetCameraForward(); Vector3 camPos = ap.GetCameraPosition(); Vector3 botPos = ap.GetPosition(); float dir2d = Mathf.RoundToInt(Mathf.Atan2(-dir.x, dir.z) * -180f / 3.14159274f); Vector3 RelPos = camPos - botPos; Vector2 camOffset = new Vector2(RelPos.x, RelPos.z) * radarScale + radarOffset; float camScale = (10 + radarScale * 200); ap.DrawLine2D(Color.green, camOffset, new Vector2(camScale * Util.Angle("sin", dir2d + 45), camScale * Util.Angle("cos", dir2d + 45)) + camOffset); ap.DrawLine2D(Color.green, camOffset, new Vector2(camScale * Util.Angle("sin", dir2d - 45), camScale * Util.Angle("cos", dir2d - 45)) + camOffset); }
public void PolyMaker2D(AutoPilot ap, Color color, float size, float sides, float angle, Vector2 pos) { float degree = 360 / sides; for (int i = 0; i < sides; i++) { ap.DrawLine2D(color, new Vector2(pos.x + size * Angle("sin", angle + degree * i), pos.y + size * Angle("cos", angle + degree * i)), new Vector2(pos.x + size * Angle("sin", angle + degree * i + degree), pos.y + size * Angle("cos", angle + degree * i + degree))); // ap.DrawLine2D(color, new Vector2(0,0), new Vector2(0,0)); } }