diff options
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/area_2d.cpp | 36 | ||||
-rw-r--r-- | scene/2d/area_2d.h | 10 | ||||
-rw-r--r-- | scene/2d/line_2d.cpp | 2 | ||||
-rw-r--r-- | scene/2d/line_builder.cpp | 6 | ||||
-rw-r--r-- | scene/2d/particles_2d.cpp | 48 | ||||
-rw-r--r-- | scene/2d/particles_2d.h | 6 | ||||
-rw-r--r-- | scene/2d/physics_body_2d.cpp | 20 | ||||
-rw-r--r-- | scene/2d/physics_body_2d.h | 4 | ||||
-rw-r--r-- | scene/2d/ray_cast_2d.cpp | 18 | ||||
-rw-r--r-- | scene/2d/ray_cast_2d.h | 6 | ||||
-rw-r--r-- | scene/2d/tile_map.cpp | 6 |
11 files changed, 81 insertions, 81 deletions
diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index 8bce489624..aca7a8c736 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -501,15 +501,15 @@ uint32_t Area2D::get_collision_mask() const { return collision_mask; } -void Area2D::set_layer_mask(uint32_t p_mask) { +void Area2D::set_collision_layer(uint32_t p_layer) { - layer_mask = p_mask; - Physics2DServer::get_singleton()->area_set_layer_mask(get_rid(), p_mask); + collision_layer = p_layer; + Physics2DServer::get_singleton()->area_set_collision_layer(get_rid(), p_layer); } -uint32_t Area2D::get_layer_mask() const { +uint32_t Area2D::get_collision_layer() const { - return layer_mask; + return collision_layer; } void Area2D::set_collision_mask_bit(int p_bit, bool p_value) { @@ -527,19 +527,19 @@ bool Area2D::get_collision_mask_bit(int p_bit) const { return get_collision_mask() & (1 << p_bit); } -void Area2D::set_layer_mask_bit(int p_bit, bool p_value) { +void Area2D::set_collision_layer_bit(int p_bit, bool p_value) { - uint32_t mask = get_layer_mask(); + uint32_t layer = get_collision_layer(); if (p_value) - mask |= 1 << p_bit; + layer |= 1 << p_bit; else - mask &= ~(1 << p_bit); - set_layer_mask(mask); + layer &= ~(1 << p_bit); + set_collision_layer(layer); } -bool Area2D::get_layer_mask_bit(int p_bit) const { +bool Area2D::get_collision_layer_bit(int p_bit) const { - return get_layer_mask() & (1 << p_bit); + return get_collision_layer() & (1 << p_bit); } void Area2D::_bind_methods() { @@ -577,14 +577,14 @@ void Area2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_collision_mask", "collision_mask"), &Area2D::set_collision_mask); ClassDB::bind_method(D_METHOD("get_collision_mask"), &Area2D::get_collision_mask); - ClassDB::bind_method(D_METHOD("set_layer_mask", "layer_mask"), &Area2D::set_layer_mask); - ClassDB::bind_method(D_METHOD("get_layer_mask"), &Area2D::get_layer_mask); + ClassDB::bind_method(D_METHOD("set_collision_layer", "collision_layer"), &Area2D::set_collision_layer); + ClassDB::bind_method(D_METHOD("get_collision_layer"), &Area2D::get_collision_layer); ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &Area2D::set_collision_mask_bit); ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &Area2D::get_collision_mask_bit); - ClassDB::bind_method(D_METHOD("set_layer_mask_bit", "bit", "value"), &Area2D::set_layer_mask_bit); - ClassDB::bind_method(D_METHOD("get_layer_mask_bit", "bit"), &Area2D::get_layer_mask_bit); + ClassDB::bind_method(D_METHOD("set_collision_layer_bit", "bit", "value"), &Area2D::set_collision_layer_bit); + ClassDB::bind_method(D_METHOD("get_collision_layer_bit", "bit"), &Area2D::get_collision_layer_bit); ClassDB::bind_method(D_METHOD("set_monitoring", "enable"), &Area2D::set_monitoring); ClassDB::bind_method(D_METHOD("is_monitoring"), &Area2D::is_monitoring); @@ -622,7 +622,7 @@ void Area2D::_bind_methods() { ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "monitoring"), "set_monitoring", "is_monitoring"); ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "monitorable"), "set_monitorable", "is_monitorable"); ADD_GROUP("Collision", "collision_"); - ADD_PROPERTYNO(PropertyInfo(Variant::INT, "collision_layers", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_layer_mask", "get_layer_mask"); + ADD_PROPERTYNO(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_layer", "get_collision_layer"); ADD_PROPERTYNO(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_mask", "get_collision_mask"); } @@ -641,7 +641,7 @@ Area2D::Area2D() monitoring = false; monitorable = false; collision_mask = 1; - layer_mask = 1; + collision_layer = 1; set_monitoring(true); set_monitorable(true); } diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h index 3efc1abbd4..f0eb1e9240 100644 --- a/scene/2d/area_2d.h +++ b/scene/2d/area_2d.h @@ -55,7 +55,7 @@ private: real_t linear_damp; real_t angular_damp; uint32_t collision_mask; - uint32_t layer_mask; + uint32_t collision_layer; int priority; bool monitoring; bool monitorable; @@ -164,14 +164,14 @@ public: void set_collision_mask(uint32_t p_mask); uint32_t get_collision_mask() const; - void set_layer_mask(uint32_t p_mask); - uint32_t get_layer_mask() const; + void set_collision_layer(uint32_t p_layer); + uint32_t get_collision_layer() const; void set_collision_mask_bit(int p_bit, bool p_value); bool get_collision_mask_bit(int p_bit) const; - void set_layer_mask_bit(int p_bit, bool p_value); - bool get_layer_mask_bit(int p_bit) const; + void set_collision_layer_bit(int p_bit, bool p_value); + bool get_collision_layer_bit(int p_bit) const; Array get_overlapping_bodies() const; //function for script Array get_overlapping_areas() const; //function for script diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp index 80969d11b3..1a57d24342 100644 --- a/scene/2d/line_2d.cpp +++ b/scene/2d/line_2d.cpp @@ -310,7 +310,7 @@ void Line2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "points"), "set_points", "get_points"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "width"), "set_width", "get_width"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "default_color"), "set_default_color", "get_default_color"); - ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "gradient", PROPERTY_HINT_RESOURCE_TYPE, "ColorRamp"), "set_gradient", "get_gradient"); + ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "gradient", PROPERTY_HINT_RESOURCE_TYPE, "Gradient"), "set_gradient", "get_gradient"); ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture"); ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "texture_mode", PROPERTY_HINT_ENUM, "None,Tile"), "set_texture_mode", "get_texture_mode"); ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "joint_mode", PROPERTY_HINT_ENUM, "Sharp,Bevel,Round"), "set_joint_mode", "get_joint_mode"); diff --git a/scene/2d/line_builder.cpp b/scene/2d/line_builder.cpp index ea059d133d..3c1410edbb 100644 --- a/scene/2d/line_builder.cpp +++ b/scene/2d/line_builder.cpp @@ -337,7 +337,7 @@ void LineBuilder::build() { } else if (current_joint_mode == LINE_JOINT_ROUND) { Vector2 vbegin = cbegin - pos1; Vector2 vend = cend - pos1; - strip_add_arc(pos1, vend.angle_to(vbegin), orientation); + strip_add_arc(pos1, vbegin.angle_to(vend), orientation); } if (intersection_result != SEGMENT_INTERSECT) @@ -498,7 +498,7 @@ void LineBuilder::strip_add_arc(Vector2 center, float angle_delta, Orientation o if (angle_delta < 0.f) angle_step = -angle_step; - float t = vbegin.angle_to(Vector2(1, 0)); + float t = Vector2(1, 0).angle_to(vbegin); float end_angle = t + angle_delta; Vector2 rpos(0, 0); @@ -525,7 +525,7 @@ void LineBuilder::new_arc(Vector2 center, Vector2 vbegin, float angle_delta, Col if (angle_delta < 0.f) angle_step = -angle_step; - float t = vbegin.angle_to(Vector2(1, 0)); + float t = Vector2(1, 0).angle_to(vbegin); float end_angle = t + angle_delta; Vector2 rpos(0, 0); float tt_begin = -Math_PI / 2.f; diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index 27d0d07c0f..21d64c5d64 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -505,8 +505,8 @@ void Particles2D::_notification(int p_what) { Color color; - if (color_ramp.is_valid()) { - color = color_ramp->get_color_at_offset(ptime); + if (gradient.is_valid()) { + color = gradient->get_color_at_offset(ptime); } else { color = default_color; } @@ -774,14 +774,14 @@ Color Particles2D::get_color() const { return default_color; } -void Particles2D::set_color_ramp(const Ref<Gradient> &p_color_ramp) { +void Particles2D::set_gradient(const Ref<Gradient> &p_gradient) { - color_ramp = p_color_ramp; + gradient = p_gradient; } -Ref<Gradient> Particles2D::get_color_ramp() const { +Ref<Gradient> Particles2D::get_gradient() const { - return color_ramp; + return gradient; } void Particles2D::set_emissor_offset(const Point2 &p_offset) { @@ -809,19 +809,19 @@ void Particles2D::set_color_phases(int p_phases) { //Create color ramp if we have 2 or more phases. //Otherwise first phase phase will be assigned to default color. - if (p_phases > 1 && color_ramp.is_null()) { - color_ramp = Ref<Gradient>(memnew(Gradient())); + if (p_phases > 1 && gradient.is_null()) { + gradient = Ref<Gradient>(memnew(Gradient())); } - if (color_ramp.is_valid()) { - color_ramp->get_points().resize(p_phases); + if (gradient.is_valid()) { + gradient->get_points().resize(p_phases); } } //Deprecated. int Particles2D::get_color_phases() const { - if (color_ramp.is_valid()) { - return color_ramp->get_points_count(); + if (gradient.is_valid()) { + return gradient->get_points_count(); } return 0; } @@ -830,9 +830,9 @@ int Particles2D::get_color_phases() const { void Particles2D::set_color_phase_color(int p_phase, const Color &p_color) { ERR_FAIL_INDEX(p_phase, MAX_COLOR_PHASES); - if (color_ramp.is_valid()) { - if (color_ramp->get_points_count() > p_phase) - color_ramp->set_color(p_phase, p_color); + if (gradient.is_valid()) { + if (gradient->get_points_count() > p_phase) + gradient->set_color(p_phase, p_color); } else { if (p_phase == 0) default_color = p_color; @@ -843,8 +843,8 @@ void Particles2D::set_color_phase_color(int p_phase, const Color &p_color) { Color Particles2D::get_color_phase_color(int p_phase) const { ERR_FAIL_INDEX_V(p_phase, MAX_COLOR_PHASES, Color()); - if (color_ramp.is_valid()) { - return color_ramp->get_color(p_phase); + if (gradient.is_valid()) { + return gradient->get_color(p_phase); } return Color(0, 0, 0, 1); } @@ -853,8 +853,8 @@ Color Particles2D::get_color_phase_color(int p_phase) const { void Particles2D::set_color_phase_pos(int p_phase, float p_pos) { ERR_FAIL_INDEX(p_phase, MAX_COLOR_PHASES); ERR_FAIL_COND(p_pos < 0.0 || p_pos > 1.0); - if (color_ramp.is_valid() && color_ramp->get_points_count() > p_phase) { - return color_ramp->set_offset(p_phase, p_pos); + if (gradient.is_valid() && gradient->get_points_count() > p_phase) { + return gradient->set_offset(p_phase, p_pos); } } @@ -862,8 +862,8 @@ void Particles2D::set_color_phase_pos(int p_phase, float p_pos) { float Particles2D::get_color_phase_pos(int p_phase) const { ERR_FAIL_INDEX_V(p_phase, MAX_COLOR_PHASES, 0); - if (color_ramp.is_valid()) { - return color_ramp->get_offset(p_phase); + if (gradient.is_valid()) { + return gradient->get_offset(p_phase); } return 0; } @@ -996,8 +996,8 @@ void Particles2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_color", "color"), &Particles2D::set_color); ClassDB::bind_method(D_METHOD("get_color"), &Particles2D::get_color); - ClassDB::bind_method(D_METHOD("set_color_ramp:ColorRamp", "color_ramp"), &Particles2D::set_color_ramp); - ClassDB::bind_method(D_METHOD("get_color_ramp:ColorRamp"), &Particles2D::get_color_ramp); + ClassDB::bind_method(D_METHOD("set_gradient:Gradient", "gradient"), &Particles2D::set_gradient); + ClassDB::bind_method(D_METHOD("get_gradient:Gradient"), &Particles2D::get_gradient); ClassDB::bind_method(D_METHOD("set_emissor_offset", "offset"), &Particles2D::set_emissor_offset); ClassDB::bind_method(D_METHOD("get_emissor_offset"), &Particles2D::get_emissor_offset); @@ -1078,7 +1078,7 @@ void Particles2D::_bind_methods() { } ADD_PROPERTYNO(PropertyInfo(Variant::COLOR, "color/color"), "set_color", "get_color"); - ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "color/color_ramp", PROPERTY_HINT_RESOURCE_TYPE, "ColorRamp"), "set_color_ramp", "get_color_ramp"); + ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "color/color_ramp", PROPERTY_HINT_RESOURCE_TYPE, "Gradient"), "set_gradient", "get_gradient"); ADD_PROPERTYNZ(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "emission_points", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_emission_points", "get_emission_points"); diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h index 5769fdd251..856beaa836 100644 --- a/scene/2d/particles_2d.h +++ b/scene/2d/particles_2d.h @@ -169,7 +169,7 @@ private: //If no color ramp is set then default color is used. Created as simple alternative to color_ramp. Color default_color; - Ref<Gradient> color_ramp; + Ref<Gradient> gradient; void _process_particles(float p_delta); friend class ParticleAttractor2D; @@ -241,8 +241,8 @@ public: void set_color(const Color &p_color); Color get_color() const; - void set_color_ramp(const Ref<Gradient> &p_texture); - Ref<Gradient> get_color_ramp() const; + void set_gradient(const Ref<Gradient> &p_texture); + Ref<Gradient> get_gradient() const; void set_emissor_offset(const Point2 &p_offset); Point2 get_emissor_offset() const; diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 626ea10515..68270ed771 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -79,7 +79,7 @@ uint32_t PhysicsBody2D::_get_layers() const { void PhysicsBody2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_collision_layer", "mask"), &PhysicsBody2D::set_collision_layer); + ClassDB::bind_method(D_METHOD("set_collision_layer", "layer"), &PhysicsBody2D::set_collision_layer); ClassDB::bind_method(D_METHOD("get_collision_layer"), &PhysicsBody2D::get_collision_layer); ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &PhysicsBody2D::set_collision_mask); ClassDB::bind_method(D_METHOD("get_collision_mask"), &PhysicsBody2D::get_collision_mask); @@ -108,15 +108,15 @@ void PhysicsBody2D::_bind_methods() { ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "one_way_collision/max_depth"), "set_one_way_collision_max_depth", "get_one_way_collision_max_depth"); } -void PhysicsBody2D::set_collision_layer(uint32_t p_mask) { +void PhysicsBody2D::set_collision_layer(uint32_t p_layer) { - mask = p_mask; - Physics2DServer::get_singleton()->body_set_layer_mask(get_rid(), p_mask); + collision_layer = p_layer; + Physics2DServer::get_singleton()->body_set_collision_layer(get_rid(), p_layer); } uint32_t PhysicsBody2D::get_collision_layer() const { - return mask; + return collision_layer; } void PhysicsBody2D::set_collision_mask(uint32_t p_mask) { @@ -146,12 +146,12 @@ bool PhysicsBody2D::get_collision_mask_bit(int p_bit) const { void PhysicsBody2D::set_collision_layer_bit(int p_bit, bool p_value) { - uint32_t mask = get_collision_layer(); + uint32_t collision_layer = get_collision_layer(); if (p_value) - mask |= 1 << p_bit; + collision_layer |= 1 << p_bit; else - mask &= ~(1 << p_bit); - set_collision_layer(mask); + collision_layer &= ~(1 << p_bit); + set_collision_layer(collision_layer); } bool PhysicsBody2D::get_collision_layer_bit(int p_bit) const { @@ -162,7 +162,7 @@ bool PhysicsBody2D::get_collision_layer_bit(int p_bit) const { PhysicsBody2D::PhysicsBody2D(Physics2DServer::BodyMode p_mode) : CollisionObject2D(Physics2DServer::get_singleton()->body_create(p_mode), false) { - mask = 1; + collision_layer = 1; collision_mask = 1; set_one_way_collision_max_depth(0); set_pickable(false); diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h index f706111e7e..50c9865f18 100644 --- a/scene/2d/physics_body_2d.h +++ b/scene/2d/physics_body_2d.h @@ -38,7 +38,7 @@ class PhysicsBody2D : public CollisionObject2D { GDCLASS(PhysicsBody2D, CollisionObject2D); - uint32_t mask; + uint32_t collision_layer; uint32_t collision_mask; Vector2 one_way_collision_direction; float one_way_collision_max_depth; @@ -53,7 +53,7 @@ protected: static void _bind_methods(); public: - void set_collision_layer(uint32_t p_mask); + void set_collision_layer(uint32_t p_layer); uint32_t get_collision_layer() const; void set_collision_mask(uint32_t p_mask); diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index 0a1a8b56ff..cfb4059714 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -44,14 +44,14 @@ Vector2 RayCast2D::get_cast_to() const { return cast_to; } -void RayCast2D::set_layer_mask(uint32_t p_mask) { +void RayCast2D::set_collision_layer(uint32_t p_layer) { - layer_mask = p_mask; + collision_layer = p_layer; } -uint32_t RayCast2D::get_layer_mask() const { +uint32_t RayCast2D::get_collision_layer() const { - return layer_mask; + return collision_layer; } void RayCast2D::set_type_mask(uint32_t p_mask) { @@ -201,7 +201,7 @@ void RayCast2D::_update_raycast_state() { Physics2DDirectSpaceState::RayResult rr; - if (dss->intersect_ray(gt.get_origin(), gt.xform(to), rr, exclude, layer_mask, type_mask)) { + if (dss->intersect_ray(gt.get_origin(), gt.xform(to), rr, exclude, collision_layer, type_mask)) { collided = true; against = rr.collider_id; @@ -274,8 +274,8 @@ void RayCast2D::_bind_methods() { ClassDB::bind_method(D_METHOD("clear_exceptions"), &RayCast2D::clear_exceptions); - ClassDB::bind_method(D_METHOD("set_layer_mask", "mask"), &RayCast2D::set_layer_mask); - ClassDB::bind_method(D_METHOD("get_layer_mask"), &RayCast2D::get_layer_mask); + ClassDB::bind_method(D_METHOD("set_collision_layer", "layer"), &RayCast2D::set_collision_layer); + ClassDB::bind_method(D_METHOD("get_collision_layer"), &RayCast2D::get_collision_layer); ClassDB::bind_method(D_METHOD("set_type_mask", "mask"), &RayCast2D::set_type_mask); ClassDB::bind_method(D_METHOD("get_type_mask"), &RayCast2D::get_type_mask); @@ -286,7 +286,7 @@ void RayCast2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "exclude_parent"), "set_exclude_parent_body", "get_exclude_parent_body"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "cast_to"), "set_cast_to", "get_cast_to"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "layer_mask", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_layer_mask", "get_layer_mask"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_layer", "get_collision_layer"); ADD_PROPERTY(PropertyInfo(Variant::INT, "type_mask", PROPERTY_HINT_FLAGS, "Static,Kinematic,Rigid,Character,Area"), "set_type_mask", "get_type_mask"); } @@ -296,7 +296,7 @@ RayCast2D::RayCast2D() { against = 0; collided = false; against_shape = 0; - layer_mask = 1; + collision_layer = 1; type_mask = Physics2DDirectSpaceState::TYPE_MASK_COLLISION; cast_to = Vector2(0, 50); exclude_parent_body = true; diff --git a/scene/2d/ray_cast_2d.h b/scene/2d/ray_cast_2d.h index cfecfa2585..244f4302ad 100644 --- a/scene/2d/ray_cast_2d.h +++ b/scene/2d/ray_cast_2d.h @@ -43,7 +43,7 @@ class RayCast2D : public Node2D { Vector2 collision_point; Vector2 collision_normal; Set<RID> exclude; - uint32_t layer_mask; + uint32_t collision_layer; uint32_t type_mask; bool exclude_parent_body; @@ -61,8 +61,8 @@ public: void set_cast_to(const Vector2 &p_point); Vector2 get_cast_to() const; - void set_layer_mask(uint32_t p_mask); - uint32_t get_layer_mask() const; + void set_collision_layer(uint32_t p_layer); + uint32_t get_collision_layer() const; void set_type_mask(uint32_t p_mask); uint32_t get_type_mask() const; diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index eebf0efd1e..4f892a31fc 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -587,7 +587,7 @@ Map<TileMap::PosKey, TileMap::Quadrant>::Element *TileMap::_create_quadrant(cons //q.canvas_item = VisualServer::get_singleton()->canvas_item_create(); q.body = Physics2DServer::get_singleton()->body_create(use_kinematic ? Physics2DServer::BODY_MODE_KINEMATIC : Physics2DServer::BODY_MODE_STATIC); Physics2DServer::get_singleton()->body_attach_object_instance_ID(q.body, get_instance_ID()); - Physics2DServer::get_singleton()->body_set_layer_mask(q.body, collision_layer); + Physics2DServer::get_singleton()->body_set_collision_layer(q.body, collision_layer); Physics2DServer::get_singleton()->body_set_collision_mask(q.body, collision_mask); Physics2DServer::get_singleton()->body_set_param(q.body, Physics2DServer::BODY_PARAM_FRICTION, friction); Physics2DServer::get_singleton()->body_set_param(q.body, Physics2DServer::BODY_PARAM_BOUNCE, bounce); @@ -863,7 +863,7 @@ void TileMap::set_collision_layer(uint32_t p_layer) { for (Map<PosKey, Quadrant>::Element *E = quadrant_map.front(); E; E = E->next()) { Quadrant &q = E->get(); - Physics2DServer::get_singleton()->body_set_layer_mask(q.body, collision_layer); + Physics2DServer::get_singleton()->body_set_collision_layer(q.body, collision_layer); } } @@ -1286,7 +1286,7 @@ void TileMap::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collision_use_kinematic", PROPERTY_HINT_NONE, ""), "set_collision_use_kinematic", "get_collision_use_kinematic"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "collision_friction", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_collision_friction", "get_collision_friction"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "collision_bounce", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_collision_bounce", "get_collision_bounce"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layers", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_layer", "get_collision_layer"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_layer", "get_collision_layer"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_mask", "get_collision_mask"); ADD_GROUP("Occluder", "occluder_"); |