I would like to assign random values to theta in order to stagger sinusoidal motion randomly at instantiation:
GDScript:
func _ready():
get_material().set_shader_param("theta",randf()*3.1415)
pass
shader:
shader_type canvas_item;
uniform float theta : hint_range(0.0,3.1415);
void vertex() {
if(sin(TIME+theta)>0.0){
VERTEX.x += 20.0*sin((TIME+theta)*2.0);
}
}
but the nodes are instantiated all with the same value. Can anyone help with this?
Thank you in advance.