Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ashish |
Hi,
I have written this code:
func _input(event)
if InputEventScreenDrag:
item = event.position
$“Bucket1”.rect_position = item
Here ‘Bucket1’ is a TextureRect and is a child of a Node2D.
When I run the project, I find that there is constant spatial difference between the cursor and ‘Bucket1’.
The difference is about Vector2(550,350)
Why is it so? I have assigned ‘Bucket1’ to ‘item’, which is at the event position.
What am I doing wrong? Do we need to do some transform in code?
Also, I have a TouchScreen Button which is a Child of a Sprite. The Sprite is a child of a Node2D. How do I find the position of the TouchScreen Button?
Thanks in advance