Properties
-
Node3D BOUNDS -
Vector3[] path_points = [] -
int current_path_index = 0 -
float path_timer = 0.0 -
float path_update_interval = 5.0 -
float visit_distance = 0.2 -
float distance_threshold = 4.0 -
Vector3[] available_waypoints = [] -
Array[] perimeter_boundary = [] -
PackedVector3Array bounds_vertices = [] -
Array[] bounds_edges = [] -
Vector2 bounds_min -
Vector2 bounds_max -
Vector2[] cached_perimeter_polygon = [] -
Array[] cached_hole_polygons = [] -
Dictionary waypoint_visit_times = {} -
float waypoint_cooldown = 15.0 -
float favor_unvisited_multiplier = 3.0 -
Node3D debug_container = null -
MeshInstance3D debug_path_line = null -
bool show_debug = false -
float max_speed = 0.5 -
float min_speed = 0.1 -
float speed_distance_threshold = 2.0 -
Vector2 current_movement_direction = Vector2(0, 0) -
float direction_change_threshold = 0.3 -
float stuck_detection_timer = 0.0 -
float stuck_check_interval = 2.0 -
Vector2 last_position = Vector2(0, 0) -
float min_expected_movement = 0.1 -
bool is_idling_between_points = false -
float idle_timer = 0.0 -
float idle_duration = 2.0 -
float direction_change_timer = 0.0 -
float direction_change_interval = 2.0 -
Vector2 current_input = Vector2(0, 0) -
float stuck_threshold_time = 3.0
Methods
-
void _ready() -
void _physics_process(float delta) -
void _move_towards_current_target(float delta) -
void _pick_new_path() -
Vector3 _find_next_waypoint_in_range(Vector3 from_point, Vector3[] candidates) -
void _analyze_bounds_mesh() -
void _extract_vertices_and_edges_from_mesh(MeshInstance3D mesh_instance) -
void _add_edge(int v1, int v2) -
void _detect_perimeter_boundary() -
void _count_edge_usage(Dictionary edge_count, int v1, int v2) -
void _generate_pathfinding_waypoints() -
void clear_waypoints() -
void _generate_pathfinding_waypoints_async() -
bool _is_point_inside_shape(Vector2 point) -
bool _is_point_inside_perimeter_polygon(Vector2 point) -
Array[] _get_all_perimeter_components() -
Vector2[] _get_largest_perimeter_component() -
Vector2[] _get_ordered_perimeter_points() -
void _create_debug_visualization() -
void _debug_draw_perimeter() -
void _debug_draw_holes() -
void _debug_draw_waypoints() -
void _debug_draw_bounds() -
void _update_debug_path() -
MeshInstance3D _create_debug_sphere(float radius, Color color) -
bool _is_point_inside_any_hole(Vector2 point) -
bool _is_point_inside_polygon(Vector2 point, Array polygon) -
bool _is_point_safely_inside_perimeter(Vector2 point, float safety_margin = 0.5) -
float _distance_point_to_line_segment(Vector2 point, Vector2 line_start, Vector2 line_end) -
bool _path_crosses_perimeter(Vector3 point1, Vector3 point2) -
bool _path_crosses_holes(Vector3 point1, Vector3 point2) -
bool _line_segments_intersect_robust(Vector2 p1, Vector2 q1, Vector2 p2, Vector2 q2) -
int _orientation(Vector2 p, Vector2 q, Vector2 r) -
bool _point_on_segment_robust(Vector2 p, Vector2 q, Vector2 r) -
void _mark_waypoint_visited(Vector3 waypoint) -
bool _is_waypoint_available(Vector3 waypoint) -
float _get_waypoint_preference_score(Vector3 waypoint, float distance) -
Vector3 _find_nearest_waypoint_to_position(Vector3 position) -
Node _find_node_by_name(Node node, String name) -
void _pick_new_direction()
Download