1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Remove infinite inertia and ray shapes from CharacterBody

Infinite inertia:
Not needed anymore, since it's now possible to set one-directional
collision layers in order for characters to ignore rigid bodies, while
rigid bodies still collide with characters.

Ray shapes:
They were introduced as a work around to allow constant speed on slopes,
which is now possible with the new property in CharacterBody instead.
This commit is contained in:
PouleyKetchoupp
2021-08-10 11:48:19 -07:00
parent ac1dab5062
commit 4da3a87f7d
46 changed files with 220 additions and 1634 deletions

View File

@@ -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();