[027] FlowField Pathfinding v2
[027] FlowField Pathfinding v2
[25h] Wall Avoidance using Rect2 & Geometry
[Mar 18] 5h - FlowField Pathfinding Review [Mar 19] 7h - Diagonal Blocks / Corner Directions [Mar 20] 6h - Wall Avoidance [Mar 21] 7h - Wall Avoidance Fixed - Units will now completely avoid walls in it's pathfinding - Diagonal Walls now blocks completely in FlowField calculation - Tilemap Corner Collision causing stuck units - Units being pushed into another tile causes stuck units > stuck detection (same position for 0.1s) and solution (refreshes collision) - Kernel Convolusion creates direction loops - but skipping walls in the calculation fixes this (TODO: not fully) _sub_position = position for _wall in _wall_array: if _sub_position.x < _wall.position.x || _sub_position.y < _wall.position.y \ || _sub_position.x > _wall.end.x || _sub_position.y > _wall.end.y: # outside wall _wall_near = _sub_position.clamp(_wall.position, _wall.end) _wall_distance = _sub_position.distance_to(_wall_near) # always positive outside _wall_overlap = _radius - _wall_distance if _wall_overlap > 0: # 0 = circle is right at edge _wall_direction = _sub_position.direction_to(_wall_near) # + = circle inside rect _sub_position -= _wall_direction * _wall_overlap # - = circle outside rect else: _wall_near = _rectangle_closest_point(_wall, _sub_position) # inside wall if _sub_position != _wall_near: # push out wall _wall_direction = _sub_position.direction_to(_wall_near) else: # circle at rect border _wall_direction = _sub_position.direction_to(_wall.get_center()) * -1 # avoid (0, 0) _sub_position = _wall_near + (_wall_direction * _radius)
Status | Released |
Platforms | HTML5 |
Author | QuietGodot |
Made with | Godot |
Leave a comment
Log in with itch.io to leave a comment.