summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-08-11 08:04:09 +0200
committerGitHub <noreply@github.com>2021-08-11 08:04:09 +0200
commit7d43da928f63d247645f54618fea9479cca838d0 (patch)
tree00e794a3db3c91e67e1fbdc3edad2c2b0e7f8f79 /editor/plugins
parent2c88e1c15df283be9b67affa24b533f5858bc913 (diff)
parent4da3a87f7d31dda644f6bd6dc300bd6e4f7eef79 (diff)
Merge pull request #51490 from nekomatata/clean-character-body
Remove infinite inertia and ray shapes from CharacterBody
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.cpp41
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.h1
-rw-r--r--editor/plugins/node_3d_editor_gizmos.cpp53
3 files changed, 0 insertions, 95 deletions
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp
index 2c2adc2672..5a6b7d98d3 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.cpp
+++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp
@@ -37,7 +37,6 @@
#include "scene/resources/concave_polygon_shape_2d.h"
#include "scene/resources/convex_polygon_shape_2d.h"
#include "scene/resources/line_shape_2d.h"
-#include "scene/resources/ray_shape_2d.h"
#include "scene/resources/rectangle_shape_2d.h"
#include "scene/resources/segment_shape_2d.h"
@@ -86,15 +85,6 @@ Variant CollisionShape2DEditor::get_handle_value(int idx) const {
} break;
- case RAY_SHAPE: {
- Ref<RayShape2D> ray = node->get_shape();
-
- if (idx == 0) {
- return ray->get_length();
- }
-
- } break;
-
case RECTANGLE_SHAPE: {
Ref<RectangleShape2D> rect = node->get_shape();
@@ -167,15 +157,6 @@ void CollisionShape2DEditor::set_handle(int idx, Point2 &p_point) {
} break;
- case RAY_SHAPE: {
- Ref<RayShape2D> ray = node->get_shape();
-
- ray->set_length(Math::abs(p_point.y));
-
- canvas_item_editor->update_viewport();
-
- } break;
-
case RECTANGLE_SHAPE: {
if (idx < 8) {
Ref<RectangleShape2D> rect = node->get_shape();
@@ -277,16 +258,6 @@ void CollisionShape2DEditor::commit_handle(int idx, Variant &p_org) {
} break;
- case RAY_SHAPE: {
- Ref<RayShape2D> ray = node->get_shape();
-
- undo_redo->add_do_method(ray.ptr(), "set_length", ray->get_length());
- undo_redo->add_do_method(canvas_item_editor, "update_viewport");
- undo_redo->add_undo_method(ray.ptr(), "set_length", p_org);
- undo_redo->add_undo_method(canvas_item_editor, "update_viewport");
-
- } break;
-
case RECTANGLE_SHAPE: {
Ref<RectangleShape2D> rect = node->get_shape();
@@ -428,8 +399,6 @@ void CollisionShape2DEditor::_get_current_shape_type() {
shape_type = CONVEX_POLYGON_SHAPE;
} else if (Object::cast_to<LineShape2D>(*s)) {
shape_type = LINE_SHAPE;
- } else if (Object::cast_to<RayShape2D>(*s)) {
- shape_type = RAY_SHAPE;
} else if (Object::cast_to<RectangleShape2D>(*s)) {
shape_type = RECTANGLE_SHAPE;
} else if (Object::cast_to<SegmentShape2D>(*s)) {
@@ -507,16 +476,6 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
} break;
- case RAY_SHAPE: {
- Ref<RayShape2D> shape = node->get_shape();
-
- handles.resize(1);
- handles.write[0] = Point2(0, shape->get_length());
-
- p_overlay->draw_texture(h, gt.xform(handles[0]) - size);
-
- } break;
-
case RECTANGLE_SHAPE: {
Ref<RectangleShape2D> shape = node->get_shape();
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.h b/editor/plugins/collision_shape_2d_editor_plugin.h
index 7db6bd22aa..130ec708cf 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.h
+++ b/editor/plugins/collision_shape_2d_editor_plugin.h
@@ -47,7 +47,6 @@ class CollisionShape2DEditor : public Control {
CONCAVE_POLYGON_SHAPE,
CONVEX_POLYGON_SHAPE,
LINE_SHAPE,
- RAY_SHAPE,
RECTANGLE_SHAPE,
SEGMENT_SHAPE
};
diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp
index b8cbaaf7c1..8b098ad23b 100644
--- a/editor/plugins/node_3d_editor_gizmos.cpp
+++ b/editor/plugins/node_3d_editor_gizmos.cpp
@@ -66,7 +66,6 @@
#include "scene/resources/cylinder_shape_3d.h"
#include "scene/resources/height_map_shape_3d.h"
#include "scene/resources/primitive_meshes.h"
-#include "scene/resources/ray_shape_3d.h"
#include "scene/resources/sphere_shape_3d.h"
#include "scene/resources/surface_tool.h"
#include "scene/resources/world_margin_shape_3d.h"
@@ -4081,10 +4080,6 @@ String CollisionShape3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_g
return p_id == 0 ? "Radius" : "Height";
}
- if (Object::cast_to<RayShape3D>(*s)) {
- return "Length";
- }
-
return "";
}
@@ -4116,11 +4111,6 @@ Variant CollisionShape3DGizmoPlugin::get_handle_value(const EditorNode3DGizmo *p
return p_id == 0 ? cs2->get_radius() : cs2->get_height();
}
- if (Object::cast_to<RayShape3D>(*s)) {
- Ref<RayShape3D> cs2 = s;
- return cs2->get_length();
- }
-
return Variant();
}
@@ -4156,22 +4146,6 @@ void CollisionShape3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, i
ss->set_radius(d);
}
- if (Object::cast_to<RayShape3D>(*s)) {
- Ref<RayShape3D> rs = s;
- Vector3 ra, rb;
- Geometry3D::get_closest_points_between_segments(Vector3(), Vector3(0, 0, 4096), sg[0], sg[1], ra, rb);
- float d = ra.z;
- if (Node3DEditor::get_singleton()->is_snap_enabled()) {
- d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
- }
-
- if (d < 0.001) {
- d = 0.001;
- }
-
- rs->set_length(d);
- }
-
if (Object::cast_to<BoxShape3D>(*s)) {
Vector3 axis;
axis[p_id] = 1.0;
@@ -4330,20 +4304,6 @@ void CollisionShape3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo
ur->commit_action();
}
-
- if (Object::cast_to<RayShape3D>(*s)) {
- Ref<RayShape3D> ss = s;
- if (p_cancel) {
- ss->set_length(p_restore);
- return;
- }
-
- UndoRedo *ur = Node3DEditor::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Change Ray Shape Length"));
- ur->add_do_method(ss.ptr(), "set_length", ss->get_length());
- ur->add_undo_method(ss.ptr(), "set_length", p_restore);
- ur->commit_action();
- }
}
void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
@@ -4614,19 +4574,6 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
p_gizmo->add_collision_segments(cs2->get_debug_mesh_lines());
}
- if (Object::cast_to<RayShape3D>(*s)) {
- Ref<RayShape3D> rs = s;
-
- Vector<Vector3> points;
- points.push_back(Vector3());
- points.push_back(Vector3(0, 0, rs->get_length()));
- p_gizmo->add_lines(points, material);
- p_gizmo->add_collision_segments(points);
- Vector<Vector3> handles;
- handles.push_back(Vector3(0, 0, rs->get_length()));
- p_gizmo->add_handles(handles, handles_material);
- }
-
if (Object::cast_to<HeightMapShape3D>(*s)) {
Ref<HeightMapShape3D> hms = s;