From 071871b787684d03fd924f69603107860c8bdb99 Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Tue, 13 Oct 2020 14:09:31 +0100 Subject: Move collision layer and mask into CollisionObject. --- scene/3d/area_3d.cpp | 62 ---------------------------------------------------- 1 file changed, 62 deletions(-) (limited to 'scene/3d/area_3d.cpp') diff --git a/scene/3d/area_3d.cpp b/scene/3d/area_3d.cpp index 7e57ef90da..e187e06308 100644 --- a/scene/3d/area_3d.cpp +++ b/scene/3d/area_3d.cpp @@ -451,52 +451,6 @@ bool Area3D::overlaps_body(Node *p_body) const { return E->get().in_tree; } -void Area3D::set_collision_mask(uint32_t p_mask) { - collision_mask = p_mask; - PhysicsServer3D::get_singleton()->area_set_collision_mask(get_rid(), p_mask); -} - -uint32_t Area3D::get_collision_mask() const { - return collision_mask; -} - -void Area3D::set_collision_layer(uint32_t p_layer) { - collision_layer = p_layer; - PhysicsServer3D::get_singleton()->area_set_collision_layer(get_rid(), p_layer); -} - -uint32_t Area3D::get_collision_layer() const { - return collision_layer; -} - -void Area3D::set_collision_mask_bit(int p_bit, bool p_value) { - uint32_t mask = get_collision_mask(); - if (p_value) { - mask |= 1 << p_bit; - } else { - mask &= ~(1 << p_bit); - } - set_collision_mask(mask); -} - -bool Area3D::get_collision_mask_bit(int p_bit) const { - return get_collision_mask() & (1 << p_bit); -} - -void Area3D::set_collision_layer_bit(int p_bit, bool p_value) { - uint32_t layer = get_collision_layer(); - if (p_value) { - layer |= 1 << p_bit; - } else { - layer &= ~(1 << p_bit); - } - set_collision_layer(layer); -} - -bool Area3D::get_collision_layer_bit(int p_bit) const { - return get_collision_layer() & (1 << p_bit); -} - void Area3D::set_audio_bus_override(bool p_override) { audio_bus_override = p_override; } @@ -595,18 +549,6 @@ void Area3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_priority", "priority"), &Area3D::set_priority); ClassDB::bind_method(D_METHOD("get_priority"), &Area3D::get_priority); - ClassDB::bind_method(D_METHOD("set_collision_mask", "collision_mask"), &Area3D::set_collision_mask); - ClassDB::bind_method(D_METHOD("get_collision_mask"), &Area3D::get_collision_mask); - - ClassDB::bind_method(D_METHOD("set_collision_layer", "collision_layer"), &Area3D::set_collision_layer); - ClassDB::bind_method(D_METHOD("get_collision_layer"), &Area3D::get_collision_layer); - - ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &Area3D::set_collision_mask_bit); - ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &Area3D::get_collision_mask_bit); - - ClassDB::bind_method(D_METHOD("set_collision_layer_bit", "bit", "value"), &Area3D::set_collision_layer_bit); - ClassDB::bind_method(D_METHOD("get_collision_layer_bit", "bit"), &Area3D::get_collision_layer_bit); - ClassDB::bind_method(D_METHOD("set_monitorable", "enable"), &Area3D::set_monitorable); ClassDB::bind_method(D_METHOD("is_monitorable"), &Area3D::is_monitorable); @@ -663,10 +605,6 @@ void Area3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "linear_damp", PROPERTY_HINT_RANGE, "0,100,0.001,or_greater"), "set_linear_damp", "get_linear_damp"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "angular_damp", PROPERTY_HINT_RANGE, "0,100,0.001,or_greater"), "set_angular_damp", "get_angular_damp"); - ADD_GROUP("Collision", "collision_"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_layer", "get_collision_layer"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask"); - ADD_GROUP("Audio Bus", "audio_bus_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "audio_bus_override"), "set_audio_bus_override", "is_overriding_audio_bus"); ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "audio_bus_name", PROPERTY_HINT_ENUM, ""), "set_audio_bus_name", "get_audio_bus_name"); -- cgit v1.2.3