Godot Version
godot-4
Question
Why doesnt it spawn an monsta at the Players location (famous german internet celebrity)?
extends Node
@export var monsta: PackedScene
func monstaspawn():
if Input.is_action_just_pressed("monstaspan(debug)"):
spawnmonsta()
func spawnmonsta():
var fliegendermonsta = monsta.instantiate()
add_child(fliegendermonsta)
fliegendermonsta.transform = $Drache.global_transform
Where are you calling the monstaspawn function? We can’t see it anywhere. Is it being called every process cycle?
You need to call that function so the code that checks for the input you want actually executes. Otherwise it’ll never execute.
Also dont put that in the process method! You will find out very quickly why thats a bad idea.
fliegendermonsta.transform = $Drache.global_transform looks wrong.
You already set the fliegendermonsta as child of some other node, it will move and rotate like an appendage of its parent. And then you set its parent-local transform to some other node’s global transform. It might just be spawning on the wrong place offscreen.
try commenting out that last line and seeing if something shows up around the node that spawned it (if it even is a Node3D or Node2D at all), or (0,0,0).