0 votes

Is it possible to somehow move the edge of a mesh. Like let's say a vertical plane, it has four edges can a shader allow you to change the top edge translation and if yes how do I achieve this

in Engine by (161 points)

1 Answer

+1 vote

Before I say something, I want you to know any changes you make to the mesh using shaders would only be purely visual. So, meaning your collision shape won't change at all. If that doesn't bother you then here:

uniform float topMargin : hint_range(1.0,128.0) = 1.0;

void vertex() {
    UV=UV*uv1_scale.xy+uv1_offset.xy;
    VERTEX.y *=  topMargin; 
    //this will make it grow taller in both directions(top and bottom). 
    VERTEX.y += topMargin - 1.0;
    //this will move it up.
}
by (271 points)

in shaderparam there should be a new item called topMargin, use it to adjust how much the must be.

Thanks I'll give it a try

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.