+2 votes

I am working on a dash mechanic for a KinematicBody2D, using a Tween node. It essentially ramps up the velocity and then brings it back down very quickly, resulting in a "dash" that still works with physics. I have a particle trail following the player's feet as if it is dust, but when the player dashes, it moves so fast that the system only emits from about 4 distinct places on the path (4 frames of the player dashing).

What would be the best way to emit particles continuously across the path that the player moves?

Here are some images to convey what I'm talking about:
walking trail
dashing trail

in Engine by (135 points)

2 Answers

–1 vote

Bump the amount of emitted particles :)

by (176 points)

This doesn't work because for any given frame in the dash, the player is only in one of 4 discrete positions. All it does is increase the density at those points.

Since the particle system is a child of the player and has the same position, it's emission will only be from those 4 points, no matter how many particles are released.

For example, the position value of the player may look like this during walking (with x's as values):

-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x

And like this during a dash:

x------------x--------------x--------------x

Assuming that your character is moving in a straight line between frames, can you store the previous position and the current position per frame and then calculate the points along the line and emit particles along that line?

Would that work?

I thought of that -- the only caveat is that I imagine emitting all of those particles at once along the line would make it look like 4 "sections" of similar particles that all disappear at the exact same time. Maybe the answer is to dynamically change the lifetime of the particles as I go down the line?

Another thing is that I'm not too familiar with the particle system in Godot -- is there a good way to emit particles one by one from a script like that? Remember that this all has to be in one frame.

–1 vote

Hi Ben, try to set the 'Explosiveness' property in the Particles2D inspector. Setting it to a higher value will make the the particles emit more rapidly.

So you could either increase the value of Explosiveness while you're dashing and set it back to normal after the dash is completed - or - you could make another particles2D scene to activate while dashing.

by (12 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.