Преглед изворни кода

Merge pull request #10054 from Hassan-A/raycastfix

ray cast 2d arrow fix
Rémi Verschelde пре 8 година
родитељ
комит
e160084c40
1 измењених фајлова са 4 додато и 4 уклоњено
  1. 4 4
      scene/2d/ray_cast_2d.cpp

+ 4 - 4
scene/2d/ray_cast_2d.cpp

@@ -127,16 +127,16 @@ void RayCast2D::_notification(int p_what) {
 				break;
 			Matrix32 xf;
 			xf.rotate(cast_to.angle());
-			xf.translate(Vector2(cast_to.length(), 0));
+			xf.translate(Vector2(0, cast_to.length()));
 
 			//Vector2 tip = Vector2(0,s->get_length());
 			Color dcol = get_tree()->get_debug_collisions_color(); //0.9,0.2,0.2,0.4);
 			draw_line(Vector2(), cast_to, dcol, 3);
 			Vector<Vector2> pts;
 			float tsize = 4;
-			pts.push_back(xf.xform(Vector2(tsize, 0)));
-			pts.push_back(xf.xform(Vector2(0, 0.707 * tsize)));
-			pts.push_back(xf.xform(Vector2(0, -0.707 * tsize)));
+			pts.push_back(xf.xform(Vector2(0, tsize)));
+			pts.push_back(xf.xform(Vector2(0.707 * tsize, 0)));
+			pts.push_back(xf.xform(Vector2(-0.707 * tsize, 0)));
 			Vector<Color> cols;
 			for (int i = 0; i < 3; i++)
 				cols.push_back(dcol);