How to force Editor ignore mouse click on Line2D in child scene

Godot Version

4.3

Question

I created portals to teleport player around. For debug i add animated lines that connects two portals and make it also shown in editor window.
It all works fine, but when i click and drag line that connects two any portal it also changes position of line parent portal.
Is there a way to force editor ignore click on Line2D, so it not select node and did not change it position, and just lick click through.

2024-09-17_17-15-04

I think the easiest solution for this is to just select your nodes in your node hierarchy and use the movement tool to drag your node around. (W as shortcut)

Problem is - when i try to move node that below that line it just move portal node, not node i need to move and this may lead in future that portals begin misplaced if i move it by mistake this way.

And also whe i try move child portal node it sometime not move it, but instead just linked portal node, couse i hit the line.

I figure out what problem was!

It all because i add Line2D to portal scene in editor.

I delete it from editor and add in _ready()

So now i have working code:

var connectLine: Line2D

@onready var line_shader_material = preload("res://resorces/materials/animated_dotted_line.tres")
@onready var line_texture = preload("res://resorces/texture/ui/dotted_line.tres")

func _ready() -> void:
	connectLine = Line2D.new()
	self.add_child(connectLine)
	connectLine.points = [to_local(self.global_position), to_local(exit_portal.global_position)]
	connectLine.width = 3
		
	connectLine.texture = line_texture
	connectLine.set_texture_mode(Line2D.LineTextureMode.LINE_TEXTURE_TILE)
	connectLine.set_texture_repeat(CanvasItem.TextureRepeat.TEXTURE_REPEAT_ENABLED)

	connectLine.material = line_shader_material

And all worked just fine!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.