You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Use builtin Vector2 functions for calculation of angles.
.
This commit is contained in:
@@ -2927,7 +2927,7 @@ void CanvasItemEditor::_draw_ruler_tool() {
|
||||
viewport->draw_string(font, text_pos, TS->format_number(vformat("%.1f px", length_vector.length())), HALIGN_LEFT, -1, font_size, font_color, outline_size, outline_color);
|
||||
|
||||
if (draw_secondary_lines) {
|
||||
const real_t horizontal_angle_rad = atan2(length_vector.y, length_vector.x);
|
||||
const real_t horizontal_angle_rad = length_vector.angle();
|
||||
const real_t vertical_angle_rad = Math_PI / 2.0 - horizontal_angle_rad;
|
||||
const int horizontal_angle = round(180 * horizontal_angle_rad / Math_PI);
|
||||
const int vertical_angle = round(180 * vertical_angle_rad / Math_PI);
|
||||
|
||||
Reference in New Issue
Block a user