summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOvnuniarchos <pujalte.jorge@gmail.com>2015-11-19 12:01:28 +0100
committerOvnuniarchos <pujalte.jorge@gmail.com>2015-11-19 16:13:45 +0100
commit1396ae274aa9690969feb855e477a349aade1cf1 (patch)
treea67151ea23e71449504ea500b18709f81dd7f157
parentf2727b8dd236ceda27a0c0fa28477b1f0558fe18 (diff)
get_handle_value implemented for LINE_SHAPE. Normal length normalized.
-rw-r--r--tools/editor/plugins/collision_shape_2d_editor_plugin.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp b/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp
index f56b9a2fd9..7e5d52d17d 100644
--- a/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp
+++ b/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp
@@ -42,6 +42,13 @@ Variant CollisionShape2DEditor::get_handle_value(int idx) const {
} break;
case LINE_SHAPE: {
+ Ref<LineShape2D> line = node->get_shape();
+
+ if (idx==0) {
+ return line->get_d();
+ } else {
+ return line->get_normal();
+ }
} break;
@@ -121,7 +128,7 @@ void CollisionShape2DEditor::set_handle(int idx, Point2& p_point) {
if (idx==0){
line->set_d(p_point.length());
}else{
- line->set_normal(p_point/30.0);
+ line->set_normal(p_point.normalized());
}
canvas_item_editor->get_viewport_control()->update();