The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

+3 votes

Hello! I would like to recreate an effect similar to the one in the gif below, can someone point me to the right direction?

this

in Engine by (63 points)

Did you find a solution? I have done something similar to this in the past in Gamemaker. I am going to try and convert it into Godot. Here's the tutorial reference:

https://zackbellgames.com/2014/11/11/sprite-skewing-for-procedural-animation/

I decided to go into more of the mechanics of my project instead of making it look good first, so I'm yet to try to make this.

I'm doing the same. If I figure out a solution I'll share it with you.

3 Answers

+2 votes

The swaying effect is often achieved with pixel shaders.

The image you provided also appears to have some particle effects, which are easy to pick out because they are a lighter shade of green.

This is a Unity tutorial explaining the concepts for 3D, which you can translate/simplify to do it in 2D with Godot:
https://www.youtube.com/watch?v=aKzUsxLJ4SU

You may also wish to combine it with this technique to smooth out the 2D motion:
https://www.youtube.com/watch?v=2JbhkZe22bE

by (868 points)
0 votes

Hey,

I found this shader, which works as you want except it doesn't move more when you walk on it...

https://github.com/Maujoe/godot-simple-wind-shader-2d/tree/master/assets/maujoe.simple_wind_shader_2d

You have to play with the shader parameter, then, you'll get something like that :
https://twitter.com/i/status/1341827250082230279

by (30 points)
0 votes

I know maybe this is an old thread, but I want to try to provide the results of my experiment, I hope it helps too

  1. Download 2s wind sway shader
  2. Modify the shader script by adding

    uniform float skew: hint_range(-500.0, 500.0) = 0;

    // vertex method
    if (skew != 0.0) {
    VERTEX.x += max(0.0, (1.0-UV.y) - heightOffset) * (skew / 12.0);
    }

  3. Set the value of the skew variable when the character touches it

enter image description here

source code

by (84 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 Frequently asked questions and 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 [email protected] with your username.