How do I simulate 2D grass physics?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Chevi

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


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:

dontbeaboot | 2020-07-20 15:33

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.

Chevi | 2020-07-20 16:10

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

dontbeaboot | 2020-07-20 16:13

:bust_in_silhouette: Reply From: JimArtificer

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:

You may also wish to combine it with this technique to smooth out the 2D motion:

:bust_in_silhouette: Reply From: cmzx


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

You have to play with the shader parameter, then, you’ll get something like that :

:bust_in_silhouette: Reply From: sarapan_malam

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);
  1. Set the value of the skew variable when the character touches it

enter image description here

source code

1 Like