1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Make radius & height in CapsuleShape2D independent

This commit is contained in:
Tomasz Chabora
2020-08-30 23:15:00 +02:00
committed by kobewi
parent c00303ff55
commit f12f5b36b5
7 changed files with 56 additions and 40 deletions

View File

@@ -120,7 +120,7 @@ void CollisionShape2DEditor::set_handle(int idx, Point2 &p_point) {
if (idx == 0) {
capsule->set_radius(parameter);
} else if (idx == 1) {
capsule->set_height(parameter * 2 - capsule->get_radius() * 2);
capsule->set_height(parameter * 2);
}
canvas_item_editor->update_viewport();
@@ -440,8 +440,8 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
float radius = shape->get_radius();
float height = shape->get_height() / 2;
handles.write[0] = Point2(radius, height);
handles.write[1] = Point2(0, height + radius);
handles.write[0] = Point2(radius, 0);
handles.write[1] = Point2(0, height);
p_overlay->draw_texture(h, gt.xform(handles[0]) - size);
p_overlay->draw_texture(h, gt.xform(handles[1]) - size);