PolygonPathFinder

继承: Resource < RefCounted < Object

该类目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!

方法


方法说明

PackedVector2Array find_path ( from: Vector2, to: Vector2 )

该方法目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!


Rect2 get_bounds ( ) const1

该方法目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!


Vector2 get_closest_point ( point: Vector2 ) const1

该方法目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!


PackedVector2Array get_intersections ( from: Vector2, to: Vector2 ) const1

该方法目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!


float get_point_penalty ( idx: int ) const1

该方法目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!


bool is_point_inside ( point: Vector2 ) const1

Returns true if point falls inside the polygon area.


    var polygon_path_finder = PolygonPathFinder.new()
    var points = [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)
    print(polygon_path_finder.is_point_inside(Vector2(0.2, 0.2))) # Prints true
    print(polygon_path_finder.is_point_inside(Vector2(1.0, 1.0))) # Prints false

    var polygonPathFinder = new PolygonPathFinder();
    var points = new Vector2[]
    {
        new Vector2(0.0f, 0.0f),
        new Vector2(1.0f, 0.0f),
        new Vector2(0.0f, 1.0f)
    };
    var connections = new int[] { 0, 1, 1, 2, 2, 0 };
    polygonPathFinder.Setup(points, connections);
    GD.Print(polygonPathFinder.IsPointInside(new Vector2(0.2f, 0.2f))); // Prints true
    GD.Print(polygonPathFinder.IsPointInside(new Vector2(1.0f, 1.0f))); // Prints false

void set_point_penalty ( idx: int, penalty: float )

该方法目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!


void setup ( points: PackedVector2Array, connections: PackedInt32Array )

Sets up PolygonPathFinder with an array of points that define the vertices of the polygon, and an array of indices that determine the edges of the polygon.

The length of connections must be even, returns an error if odd.


    var polygon_path_finder = PolygonPathFinder.new()
    var points = [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();
    var points = new Vector2[]
    {
        new Vector2(0.0f, 0.0f),
        new Vector2(1.0f, 0.0f),
        new Vector2(0.0f, 1.0f)
    };
    var connections = new int[] { 0, 1, 1, 2, 2, 0 };
    polygonPathFinder.Setup(points, connections);
2

本方法通常需要用户覆盖才能生效。

1

本方法无副作用,不会修改该实例的任何成员变量。

3

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

4

本方法用于构造某个类型。

5

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。