diff options
author | tefusion <makotoprogr4mming@gmail.com> | 2022-06-21 22:15:46 +0200 |
---|---|---|
committer | tefusion <makotoprogr4mming@gmail.com> | 2022-06-22 17:34:49 +0200 |
commit | ad7b3549a58a4d4ec821fdd33579c32c9a1d77f0 (patch) | |
tree | 0c3e4d1035cc3f3583b367759bf404df2273d04d | |
parent | 3ccff61979140493e4987f16558b5fab39b4b2b7 (diff) | |
download | redot-engine-ad7b3549a58a4d4ec821fdd33579c32c9a1d77f0.tar.gz |
Fix CapsuleMesh loading issue (radius reset)
-rw-r--r-- | scene/resources/primitive_meshes.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index b2fd8eb895..f4fd81b25f 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -439,12 +439,15 @@ void CapsuleMesh::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "height", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater,suffix:m"), "set_height", "get_height"); ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1,or_greater"), "set_radial_segments", "get_radial_segments"); ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1,or_greater"), "set_rings", "get_rings"); + + ADD_LINKED_PROPERTY("radius", "height"); + ADD_LINKED_PROPERTY("height", "radius"); } void CapsuleMesh::set_radius(const float p_radius) { radius = p_radius; if (radius > height * 0.5) { - radius = height * 0.5; + height = radius * 2.0; } _request_update(); } @@ -456,7 +459,7 @@ float CapsuleMesh::get_radius() const { void CapsuleMesh::set_height(const float p_height) { height = p_height; if (radius > height * 0.5) { - height = radius * 2; + radius = height * 0.5; } _request_update(); } |