What's the right way to create particle effects at a static position? For example when the main character double jumps I want to create some one shot particles at the position where he double jumped, without those particles are following the player. I'm just learning Godot via the problem solving approach.

It sounds like the particles are following the player because they are being added to the player's scene. To keep the particles from moving, they should instead be parented to the same scene that the player is parented to, which would likely be a level scene.

Thanks for the answer. Wouldn't it be better if I just create a scene with a node containing all one time particle effects which I'd need (variety of particles like for example, getting hit, sword slash, double jump etc) and upon an event, I create the scene as an object and initiate the particles which I need? Because if I attach it to the main scene there will be only one instance and if I decide to make a triple jump with the same particles, I should add it to the main scene again and this many times to every level (if each level is a different scene). Does this make sense?

You don't need to make a special scene that holds all the particle effects you need. Instead, you can just instantiate a new instance of the particle effect you need. This approach allows multiple copies of the same particle effect to exist at once.

To do this, you can just load in the particle effects and store them as a variable on each script that needs that particle effect. To do this, you could create a new variable like: var particles = preload("res://Particles.tscn")

Then, to spawn these particles at a certain position, you could call:

var new_particles = particles.instance()
new_particles.translation = position
level_scene.add_child(new_particles)

particles holds the scene for the particles you want to spawn. new_particles holds the instance of our newly spawned particles. position is a Vector3 representing where you want to spawn the particles. level_scene is the root node of the level scene.

The place where you spawn the particles doesn't necessarily have to be the level scene, but most projects I've seen are structured in a way where it makes sense to spawn the particles there, because that's where the player is parented to.

3 years later