summaryrefslogtreecommitdiff
path: root/scene/resources/box_shape_3d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/box_shape_3d.cpp')
-rw-r--r--scene/resources/box_shape_3d.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/scene/resources/box_shape_3d.cpp b/scene/resources/box_shape_3d.cpp
index 6e7adc0bd7..008914c5ee 100644
--- a/scene/resources/box_shape_3d.cpp
+++ b/scene/resources/box_shape_3d.cpp
@@ -56,6 +56,26 @@ void BoxShape3D::_update_shape() {
Shape3D::_update_shape();
}
+#ifndef DISABLE_DEPRECATED
+bool BoxShape3D::_set(const StringName &p_name, const Variant &p_value) {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ // Convert to `size`, twice as big.
+ set_size((Vector3)p_value * 2);
+ return true;
+ }
+ return false;
+}
+
+bool BoxShape3D::_get(const StringName &p_name, Variant &r_property) const {
+ if (p_name == "extents") { // Compatibility with Godot 3.x.
+ // Convert to `extents`, half as big.
+ r_property = size / 2;
+ return true;
+ }
+ return false;
+}
+#endif // DISABLE_DEPRECATED
+
void BoxShape3D::set_size(const Vector3 &p_size) {
size = p_size;
_update_shape();