0 votes

Alright, so, I was designing some menus using Controls in Godot, and I had a cool idea to make an infinitely scrolling chevron on it. My guess on how to do it was to have the texture tile, and then set some sort of horizontal texture offset parameter on it to increment via script, to seemingly animate it. The issue is, I couldn't find any options to offset only the texture, in the style of UVs. Did I do something wrong while looking, or is this not a thing? This is how I would have done it anywhere else.

in Engine by (15 points)

1 Answer

+3 votes
Best answer

I can only think of a shader.

A simple example of scrolling texture shader (texture must be imported with repeat enabled):

shader_type canvas_item;

void fragment(){
    vec2 newuv = UV;
    newuv.x += TIME;
    vec4 c = texture(TEXTURE, newuv);
    COLOR = c;

It will need an uniform to control the offset correctly instead of time based as the example.

by (7,922 points)
selected by

This works very well, thanks. I completely forgot UVs work like that, d'oh.

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.