summaryrefslogtreecommitdiff
path: root/scene/2d/collision_polygon_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d/collision_polygon_2d.cpp')
-rw-r--r--scene/2d/collision_polygon_2d.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index d9cc94c6eb..4edf92197e 100644
--- a/scene/2d/collision_polygon_2d.cpp
+++ b/scene/2d/collision_polygon_2d.cpp
@@ -61,16 +61,15 @@ void CollisionPolygon2D::_build_polygon() {
Ref<ConcavePolygonShape2D> concave = memnew(ConcavePolygonShape2D);
- PoolVector<Vector2> segments;
+ Vector<Vector2> segments;
segments.resize(polygon.size() * 2);
- PoolVector<Vector2>::Write w = segments.write();
+ Vector2 *w = segments.ptrw();
for (int i = 0; i < polygon.size(); i++) {
w[(i << 1) + 0] = polygon[i];
w[(i << 1) + 1] = polygon[(i + 1) % polygon.size()];
}
- w.release();
concave->set_segments(segments);
parent->shape_owner_add_shape(owner_id, concave);
@@ -306,10 +305,10 @@ void CollisionPolygon2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_one_way_collision_margin"), &CollisionPolygon2D::get_one_way_collision_margin);
ADD_PROPERTY(PropertyInfo(Variant::INT, "build_mode", PROPERTY_HINT_ENUM, "Solids,Segments"), "set_build_mode", "get_build_mode");
- ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon");
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disabled"), "set_disabled", "is_disabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_way_collision"), "set_one_way_collision", "is_one_way_collision_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "one_way_collision_margin", PROPERTY_HINT_RANGE, "0,128,0.1"), "set_one_way_collision_margin", "get_one_way_collision_margin");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "one_way_collision_margin", PROPERTY_HINT_RANGE, "0,128,0.1"), "set_one_way_collision_margin", "get_one_way_collision_margin");
BIND_ENUM_CONSTANT(BUILD_SOLIDS);
BIND_ENUM_CONSTANT(BUILD_SEGMENTS);