#Bullet ignores its position setting

1 messages · Page 1 of 1 (latest)

fallen pollen
#
  1. the node where the bullets get added 2. the shotgun node which determines player_direction and 3. is the marker whose position i want to use as the starting point for the bullet
uneven quarry
#

Every node in Godot has a position, which is its location relative to its parent node. So if the parent moves, the child’s position stays the same because it’s measured from the parent.

global_position is the node’s location relative to the entire scene (world space), ignoring where its parent is.

Example:

Imagine you have a parent node at (100, 100) and a child node with position = (50, 50).

The child’s local position is (50, 50) — that means 50 units right and 50 units down from the parent.

The child’s global_position will be (150, 150) — the actual point in the whole scene.

If the parent moves to (200, 200), the child’s position is still (50, 50), but its global_position becomes (250, 250).
Why this matters:

If your code reads position, it only sees where the child is relative to the parent. If the parent moves, the child's local position doesn't change.

If you want the child’s real position in the scene — like for placing markers, checking collisions, or syncing positions — you should use global_position.

That’s why your marker’s position doesn’t seem to change when you expect it to — you’re looking at local space instead of global space. Switching to global_position fixes that.

here a beatiful answer from chatgpt

fallen pollen
#

when i make it Marker2D.global_position the bullet does not spawn at all