Godot Version
v4.2.2
Question
Hey all, I am trying to load in a bullet image but am unsure how Godot decides the spawn location of a scene in relation to the image and Nodes tied to it. It keeps dropping the image far below and to the right of where I would expect it to be loading into the scene.
My Node tree looks like this:
\-- RPG (Area2D)
\---- CollisionShape2D
\---- Rpg (Sprite2D)
\------ ShootingPoint (Marker2D)
I have “ShootingPoint” marked as a Unique Named Node and my code to instantiate the Rocket looks like this
func shoot():
const ROCKET = preload("res://Scenes/Ammo_Scenes/rocket.tscn")
var newRocket = ROCKET.instantiate()
newRocket.global_position = %ShootingPoint.global_position
newRocket.global_rotation = %ShootingPoint.global_rotation
%ShootingPoint.add_child(newRocket)
That red cross on the front is the “ShootingPoint” but when the Rocket image loads in it loads in like this below it. This forum only lets me load in 1 picture so I can’t show what it actually looks like but hopefully I can add more details in the comments.
I would want the rocket to load in where directly on top of the red cross indicated by the “ShootingPoint”. And if that is not possible I just want to know how Godot makes the decision to spawn where it does so I can accommodate for it in the future.