0 votes

What can I do to get this effect:
https://youtu.be/rw6wNRdmBpU?t=10s

Is this a solution?
https://github.com/kestrelm/Creature_Godot

in Engine by (100 points)

1 Answer

0 votes
Best answer

There is no built-in support for such deformation, but it can be achieved in several ways:

1) Using a custom material, by modifying the vertex shader so it takes a parameter into account to deform the sprite. However it will have a limitation because by default Sprites are quads (they are made of only 4 vertices) and so they can't be deformed with much "twist" or "roll".

2) Not using a Sprite, but a custom node that will draw using more vertices, allowing more deformation details. You can see in the first video you posted that the guy has no sprite, but a kind of mesh with lots of quads in it. This allows for smoother deformation, either from a script or from a shader by combining solution 1).

So to have deformation like that you can either use an existing asset like you pointed (not sure if it was intented only for deformation?), or roll your own solution as the ones I suggested, which require a bit of work to draw your own geometry.

by (27,966 points)
selected by

Apart from this, look at the asset library, Platform2D and Messdeform use deformations techniques too that may be useful depending your case.

Another option is to wait for Godot (...) 3.0, I think it will have mesh deformations for sprites.

Source? I heard of 3D stuff coming into 2D but no built-in sprite deformation (unless what I described is applied, which works already in 2.1.1).

The 2D mesh was mentioned a couple of times by Juan, don't now if there will be time for it to be on 3.0 or 3.1

Here is one of the comments about it:
https://github.com/godotengine/godot/pull/1734#issuecomment-251170125

It would make the task a lot easier indeed :)

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.