Skip to content

Instantly share code, notes, and snippets.

@colorworlds
colorworlds / create_polygon_from_sprite.gd
Created January 17, 2021 03:38 — forked from hiulit/create_polygon_from_sprite.gd
Create a Polygon2D from a Sprite in Godot
# Thanks to Justo Delgado - a.k.a mrcdk (https://github.com/mrcdk) - for the function this one is based on.
# It can be found here https://github.com/godotengine/godot/issues/31323
# The sprite parameter must be a Sprite node.
func create_polygon_from_sprite(sprite):
# Get the sprite's texture.
var texture = sprite.texture
# Get the sprite texture's size.
var texture_size = sprite.texture.get_size()
# Get the image from the sprite's texture.
@colorworlds
colorworlds / outline-gles2.shader
Created January 17, 2021 03:37 — forked from hiulit/outline-gles2.shader
Godot 3 Outline Shader GLES2
shader_type canvas_item;
uniform float width;
uniform vec4 outline_color : hint_color;
void fragment()
{
vec2 size = (vec2(width) * TEXTURE_PIXEL_SIZE);
vec4 sprite_color = texture(TEXTURE, UV);