diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2017-10-21 22:17:26 +0200 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2017-10-21 22:17:47 +0200 |
commit | 7b12ae39f280e9168e314cba08107cce6b99c4ff (patch) | |
tree | 934372cc21bed89c10426511658a5cef6b8ece72 /scene/3d | |
parent | 6361e24f29ae735b75bcd27f9fe521397ce7c10c (diff) |
Rename RayCasts collision_layer to collision_mask
The point is that `RayCast`s are checked against objects' `collision_layer`(s), but they themselves are considered no to _belong_ to any layer. Therefore, the correct name for their property is `collision_mask`, rather than `collision_layer`.
Only renaming is needed since the behavior was already the right one, only that it wasn't matching what users would expect from the name and description of the property.
Fixes #7589, where it's also discussed.
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/ray_cast.cpp | 18 | ||||
-rw-r--r-- | scene/3d/ray_cast.h | 6 |
2 files changed, 12 insertions, 12 deletions
diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp index df6764ee1a..296bddf0a3 100644 --- a/scene/3d/ray_cast.cpp +++ b/scene/3d/ray_cast.cpp @@ -48,14 +48,14 @@ Vector3 RayCast::get_cast_to() const { return cast_to; } -void RayCast::set_collision_layer(uint32_t p_layer) { +void RayCast::set_collision_mask(uint32_t p_mask) { - collision_layer = p_layer; + collision_mask = p_mask; } -uint32_t RayCast::get_collision_layer() const { +uint32_t RayCast::get_collision_mask() const { - return collision_layer; + return collision_mask; } void RayCast::set_type_mask(uint32_t p_mask) { @@ -172,7 +172,7 @@ void RayCast::_update_raycast_state() { PhysicsDirectSpaceState::RayResult rr; - if (dss->intersect_ray(gt.get_origin(), gt.xform(to), rr, exclude, collision_layer, type_mask)) { + if (dss->intersect_ray(gt.get_origin(), gt.xform(to), rr, exclude, collision_mask, type_mask)) { collided = true; against = rr.collider_id; @@ -245,15 +245,15 @@ void RayCast::_bind_methods() { ClassDB::bind_method(D_METHOD("clear_exceptions"), &RayCast::clear_exceptions); - ClassDB::bind_method(D_METHOD("set_collision_layer", "layer"), &RayCast::set_collision_layer); - ClassDB::bind_method(D_METHOD("get_collision_layer"), &RayCast::get_collision_layer); + ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &RayCast::set_collision_mask); + ClassDB::bind_method(D_METHOD("get_collision_mask"), &RayCast::get_collision_mask); ClassDB::bind_method(D_METHOD("set_type_mask", "mask"), &RayCast::set_type_mask); ClassDB::bind_method(D_METHOD("get_type_mask"), &RayCast::get_type_mask); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "cast_to"), "set_cast_to", "get_cast_to"); - 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_PROPERTY(PropertyInfo(Variant::INT, "type_mask", PROPERTY_HINT_FLAGS, "Static,Kinematic,Rigid,Character,Area"), "set_type_mask", "get_type_mask"); } @@ -325,7 +325,7 @@ RayCast::RayCast() { against = 0; collided = false; against_shape = 0; - collision_layer = 1; + collision_mask = 1; type_mask = PhysicsDirectSpaceState::TYPE_MASK_COLLISION; cast_to = Vector3(0, -1, 0); debug_shape = NULL; diff --git a/scene/3d/ray_cast.h b/scene/3d/ray_cast.h index fd566cd343..cd3cf3c913 100644 --- a/scene/3d/ray_cast.h +++ b/scene/3d/ray_cast.h @@ -47,7 +47,7 @@ class RayCast : public Spatial { Set<RID> exclude; - uint32_t collision_layer; + uint32_t collision_mask; uint32_t type_mask; Node *debug_shape; @@ -69,8 +69,8 @@ public: void set_cast_to(const Vector3 &p_point); Vector3 get_cast_to() const; - void set_collision_layer(uint32_t p_layer); - uint32_t get_collision_layer() const; + void set_collision_mask(uint32_t p_mask); + uint32_t get_collision_mask() const; void set_type_mask(uint32_t p_mask); uint32_t get_type_mask() const; |