If i use the player position to position the laser I get the laser in the origin of the player like I want it to be. Unfortunately I need the players global_position for positioning the laser. But everytime I try this it gets offset to the right and down. Why does this happen.
I have setup a demo image of some code and the result. Both lasers should be at the same spot but the second which uses global_position is not at the origin of the player.
I tried to find the root cause but I didn't get it.
Both lasers should overlap in my understanding.
update: Now I tried this: "laser2.global_position = $Player.global_position" but it also did not work. I get the same result as with "laser2.position = $Player.global_position".
The reason why I use global_position is because I want to spawn the laser at the top of the gun with a Marker2D. I will get the position to spawn via Marker2D.global_position in the player node. Then I spawn the laser in the Level via the position = global_position of Marker2D.
Like in this tutorial https://youtu.be/nAh_Kx5Zh5Q?t=11008
not 100% certain but maybe the origin of the laser is the position of the first point of the collision shape you drew around the player?
:-)