Line2D - what is the coordinate system for the points?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JoeSeki

I’m creating a laser effect based on drawing a Line2D. It’s a board element that has a fixed start and end location. I used a 32x32 sprite, where the laser port is halfway down one side of the sprite and should shoot across the sprite maybe across more than just the sprite itself.

When I’m not shooting I remove the points from the Line2D - perfect the laser line disappears. But when I use Vector2D(16,0) as the start point the line starts in the middle of my sprite. Some experimentation says I need (-8,0) as the start point.

Where does this magic number -8 come from when my sprite is 32x32?

The second endpoint to create a horizontal line that spans the sprite length turns out to be (16,0). Why is the distance only 24 rather than my expected 32?

My sprite is 32x32 and covers 4 grid points by 4 grid points in the 2D editor.

What concept am I missing?

:bust_in_silhouette: Reply From: TchnlgPsnt

The origin of the Line2D should be at the same global position as the origin of its parent, which in this case seems to be the Sprite. The origin of the Sprite is usually its center. My guess is the sprite’s origin is slightly off. Try using the icon just to the left of the hand icon at the top of the scene viewport to adjust it.

Hope this helps!