Cursor Fix part1 ig?

This commit is contained in:
2025-07-01 22:18:04 +03:00
parent 3e489a21f4
commit a3044c01c6
2 changed files with 14 additions and 6 deletions

View File

@@ -4,7 +4,7 @@
[ext_resource type="Texture2D" uid="uid://d0hckoql2xnbq" path="res://Textures/svg/Cursor.svg" id="2_r0du0"]
[sub_resource type="CircleShape2D" id="CircleShape2D_v75j3"]
radius = 28.0713
radius = 19.0263
[node name="Cursor" type="Area2D"]
script = ExtResource("1_uu6xs")
@@ -15,3 +15,8 @@ texture = ExtResource("2_r0du0")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_v75j3")
[node name="Line2D" type="Line2D" parent="."]
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
[connection signal="area_exited" from="." to="." method="_on_area_exited"]

View File

@@ -3,7 +3,7 @@ extends Area2D
@export var ShowMouse = false
var old_mouse_pos = Vector2.ZERO
var mouse_velocity = Vector2.ZERO
@export var vector_length = Vector2(50,0)
@export var vector_length = Vector2(500,0)
@export var vector_width = 5
var line_2d : Line2D
@@ -60,8 +60,9 @@ func _process(delta: float) -> void:
func _on_area_entered(area: Area2D) -> void:
print("AAAA " + str(area.name))
if area.name == "Node2D":
print("AAAA " + str(area.name))
is_touchingCube = true
draw_vector()
@@ -82,9 +83,11 @@ func _on_area_exited(area: Area2D) -> void:
func draw_vector():
var vector_direction = Vector2.RIGHT.rotated(rotation)
var start_point = global_position
var end_point = global_position + vector_direction + vector_length
var vector_direction = Vector2().rotated(rotation)
var start_point = line_2d.to_local(global_position)
var end_point = line_2d.to_local(global_position + vector_direction + vector_length)
line_2d.add_point(start_point,1)
line_2d.add_point(end_point,2)