Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
PolygonPathFinder
Успадковує: Resource < RefCounted < Object
There is currently no description for this class. Please help us by contributing one!
Методи
get_bounds() const |
|
get_closest_point(point: Vector2) const |
|
get_intersections(from: Vector2, to: Vector2) const |
|
get_point_penalty(idx: int) const |
|
is_point_inside(point: Vector2) const |
|
void |
set_point_penalty(idx: int, penalty: float) |
void |
setup(points: PackedVector2Array, connections: PackedInt32Array) |
Описи методів
PackedVector2Array find_path(from: Vector2, to: Vector2) 🔗
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
Vector2 get_closest_point(point: Vector2) const 🔗
There is currently no description for this method. Please help us by contributing one!
PackedVector2Array get_intersections(from: Vector2, to: Vector2) const 🔗
There is currently no description for this method. Please help us by contributing one!
float get_point_penalty(idx: int) const 🔗
There is currently no description for this method. Please help us by contributing one!
bool is_point_inside(point: Vector2) const 🔗
Повертає true, якщо point потрапляє в область багатокутника.
var polygon_path_finder = PolygonPathFinder.new()
var point = [Vector2(0.0, 0.0), Vector2(1.0, 0.0), Вектор2(0.0, 1.0)]
var connections= [0, 1, 1, 2, 2, 0]
polygon_path_finder.setup(points, connections)
print(polygon_path_finder.is_point_inside(Vector2(0.2, 0.2))) # Виводить true
print(polygon_path_finder.is_point_inside(Vector2(1.0, 1.0))) # Виводить false
var polygonPathFinder = new PolygonPathFinder();
Vector2[] points =
[
new Vector2(0.0f, 0.0f),
new Vector2(1.0f, 0.0f),
new Vector2(0.0f, 1.0f)
];
int[] connections = [0, 1, 1, 2, 2, 0];
polygonPathFinder.Setup(points, connections);
GD.Print(polygonPathFinder.IsPointInside(new Vector2(0.2f, 0.2f))); // Виводить True
GD.Print(polygonPathFinder.IsPointInside(new Vector2(1.0f, 1.0f))); // Виводить False
void set_point_penalty(idx: int, penalty: float) 🔗
There is currently no description for this method. Please help us by contributing one!
void setup(points: PackedVector2Array, connections: PackedInt32Array) 🔗
Встановлює PolygonPathFinder із масивом точок, які визначають вершини багатокутника, та масивом індексів, які визначають ребра багатокутника.
Довжина connections має бути парною, повертає помилку, якщо непарна.
var polygon_path_finder = PolygonPathFinder.new()
var point = [Vector2(0.0, 0.0), Vector2(1.0, 0.0), Vector2(0.0, 1.0)]
var connections= [0, 1, 1, 2, 2, 0]
polygon_path_finder.setup(points, connections)
var polygonPathFinder = new PolygonPathFinder();
Vector2[] бали =
[
new Vector2(0.0f, 0.0f),
new Vector2(1.0f, 0.0f),
new Vector2(0.0f, 1.0f)
];
int[] connections = [0, 1, 1, 2, 2, 0];
polygonPathFinder.Setup(points, connections);