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/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 |
7 files changed, 50 insertions, 50 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/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_"); |