Skip to content

Instantly share code, notes, and snippets.

@YuriSizov
YuriSizov / ColorerRect.gd
Created July 23, 2025 13:48
Godot ColorRect's taller, more handsome cousin
@tool
class_name ColorerRect extends Control
enum FillMode {
SOLID,
FRAME,
ZONE,
}
@export var color: Color = Color.WHITE:
@tool
extends EditorScenePostImport
class MeshInstanceList:
var mesh: Mesh
var aabb: AABB
var transforms: Array
# Converts geometry node instances into MultiMeshInstances
func gn_instances_to_mm(parent: Node, scene: Node):
@thygrrr
thygrrr / CameraZoomAndPan.gd
Last active October 19, 2025 01:11
Godot Zoom and Pan, smooth & cursor-centric Camera2D motion
# SPDX-License-Identifier: Unlicense or CC0
extends Node2D
# Smooth panning and precise zooming for Camera2D
# Usage: This script may be placed on a child node
# of a Camera2D or on a Camera2D itself.
# Suggestion: Change and/or set up the three Input Actions,
# otherwise the mouse will fall back to hard-wired mouse
# buttons and you will miss out on alternative bindings,
# deadzones, and other nice things from the project InputMap.
@reduz
reduz / godot_vision_pro.md
Last active October 15, 2024 03:00
Godot on Vision Pro and similar devices

Vision Pro style API on Godot

Overview

Apple recently unveiled the Vision Pro. This type of device is mostly designed for augmented reality (AR), in the sense that it should be able to throw 3D models and rendering combined into a camera.

Normally with pass-through AR, one would expect to get the camera feed as an image and maybe some environment cubemap generated from the camera to apply proper lighting into the objects.

@passivestar
passivestar / Editor.tres
Last active January 12, 2025 21:14
Godot editor theme
[gd_resource type="Theme" load_steps=12 format=3 uid="uid://7bvxnk5n5imx"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6h42l"]
content_margin_left = 10.5
content_margin_top = 8.75
content_margin_right = 10.5
content_margin_bottom = 8.75
bg_color = Color(0.117647, 0.117647, 0.117647, 1)
draw_center = false
border_color = Color(1, 1, 1, 0.137255)
@RainCatalyst
RainCatalyst / game.gd
Last active August 31, 2022 17:52
Simple state machine in Godot
## State machine usage example
## Add states as children to the States node
extends Node
# Setup fsm
onready var fsm = StateMachine.new(self, $States, $States/menu, true)
func _process(delta):
# Update fsm
fsm.process(delta)
@Arnklit
Arnklit / generate_plane.gd
Created March 16, 2022 06:56
Subdivided Plane Set as Lod Levels in Godot 4.0
@tool
extends MeshInstance3D
@export var generate := false:
set(v):
gen_mesh()
@export_range(0, 10) var subdivisions := 5
@export var size := 8.0
@WolfgangSenff
WolfgangSenff / gist:168cb0cbd486c8c9cd507f232165b976
Last active September 18, 2025 19:55
Godot 4.0 Migration/Upgrade guide
## For a beginner-friendly version of the following (more advanced users likely will get better use of the below,
## if you're just starting out...), see this new gist:
## https://gist.github.com/WolfgangSenff/0a9c1d800db42a9a9441b2d0288ed0fd
This document represents the beginning of an upgrade or migration document for GDScript 2.0 and Godot 4.0. I'm focusing on 2D
at the moment as I'm upgrading a 2D game, but will hopefully have more to add for 3D afterward.
## If you want more content like this, please help fund my cat's medical bills at https://ko-fi.com/kyleszklenski - thank you very much! On to the migration guide.