Thursday, May 2, 2024
HomeGame Developmentspawning - Godot: Spawn an object in 3D

spawning – Godot: Spawn an object in 3D


I’ve been looking for a tutorial and am hoping that someone can point me in the right direction.

I’m working on a FPS game in Godot, and I want to be able to drop a flare on the ground at the players position.

I created a scene with a “flare”, which right now is basically just a sphere mesh instance and an omni light child.

In my player.gd I have something like this:

var instancedFlare = preload("res://flare.tscn")

func _physics_process(delta):
    if Input.is_action_just_pressed("drop_flare"):
        print("Flare!")

which prints Flare! to the output when I hit F or Y on the controller.

So I’m hoping there is a nice tutorial for spawning an object and placing it at the players position in the world that I haven’t managed to find yet.

Thanks!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments