godot-adapt-3d-to-2d
Expert patterns for simplifying 3D games to 2D including dimension reduction strategies, 2.5D fake-depth, isometric ports, camera flattening, physics conversion, 3D-to-sprite art pipeline, and control simplification. Use when porting 3D to 2D, building 2.5D / isometric / fake-depth gameplay, creating 2D versions for mobile, or prototyping. Trigger keywords: CharacterBody3D to CharacterBody2D, Camera3D to Camera2D, Vector3 to Vector2, flatten Z-axis, 2.5D, isometric, fake depth, Y-sort, simulated Z, orthogonal projection, 3D to sprite conversion, performance optimization.
thedivergentai · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add thedivergentai/GD-Agentic-Skills --skill godot-adapt-3d-to-2d技能说明
name: godot-adapt-3d-to-2d description: "Expert patterns for simplifying 3D games to 2D including dimension reduction strategies, 2.5D fake-depth, isometric ports, camera flattening, physics conversion, 3D-to-sprite art pipeline, and control simplification. Use when porting 3D to 2D, building 2.5D / isometric / fake-depth gameplay, creating 2D versions for mobile, or prototyping. Trigger keywords: CharacterBody3D to CharacterBody2D, Camera3D to Camera2D, Vector3 to Vector2, flatten Z-axis, 2.5D, isometric, fake depth, Y-sort, simulated Z, orthogonal projection, 3D to sprite conversion, performance optimization."
NEVER Do
- NEVER remove Z-axis without gameplay compensation — Blindly flattening 3D to 2D removes spatial strategy. Add other depth mechanics (layers, jump height variations).
- NEVER keep 3D collision shapes — Use simpler 2D shapes (CapsuleShape2D, RectangleShape2D). 3D shapes don't convert automatically.
- NEVER use orthographic Camera3D as "2D mode" — WHY: You still pay 3D transform/lighting costs and miss CanvasItem batching. Use Camera2D + 2D nodes (
ortho_simulation.gdonly for simulated height). - NEVER assume automatic performance gain — Poorly optimized 2D (too many draw calls, large sprite sheets) can be slower than optimized 3D.
- NEVER forget to adjust gravity — 3D gravity is Vector3(0, -9.8, 0). 2D gravity is float (980 pixels/s²). Scale appropriately.
- NEVER treat ground and air hits as the same Area2D overlap — In 2.5D, a ground slash must not hit jumping targets. WHY: 2D physics has no Z. Use
hitbox_depth_manager.gdheight AABB checks. - NEVER fight Y-sort with per-sprite
z_indexspam — WHY: Ownership of sort order belongs on the Y-sorted parent. Usedepth_sorting_y_sort.gd; manual z_index drifts every frame.
Available Scripts
MANDATORY: Read the appropriate script before implementing the corresponding pattern.
Strategy router (MANDATORY / Do NOT Load)
| Strategy | Load | Do NOT Load |
|---|---|---|
| True 2D (drop Z) | jump_z_axis_sim.gd only if platformer height remains; else CharacterBody2D patterns | ortho_simulation.gd, iso math, fake shadows |
| 2.5D / fake depth | MANDATORY ortho_simulation.gd + jump_z_axis_sim.gd + hitbox_depth_manager.gd + depth_sorting_y_sort.gd (+ parallax_depth_camera.gd / fake_3d_shadows.gd) | Manual z_index = int(y) spam; ortho Camera3D as 2D |
| Isometric stay | MANDATORY isometric_math_core.gd + depth_sorting_y_sort.gd | Cartesian-only velocity samples; Camera3D ortho fake |
| Bake 3D→sprites | MANDATORY model_to_sprite_bake.gd (+ billboard_sprite_manager.gd for Doom-style) | Blender bake recipes in body |
| Node/physics convert only | Decision tree + gravity/collision notes below | Strategy code samples; Dimensional Patcher regex without review |
ortho_simulation.gd
Simulates 3D Z-axis height in 2D top-down games. Handles vertical velocity, gravity, sprite offset, and shadow scaling.
projection_utils.gd
Projects 3D world positions to 2D screen space for nameplates, healthbars, and targeting. Handles behind-camera detection and distance-based scaling.
isometric_math_core.gd
Expert utility generating translating between 2D Cartesian and True Isometric screenspace projection matrices without using 2D Node transforms.
depth_sorting_y_sort.gd
Expert dynamic Z-index Y-Sort script for fake 3D sorting isolated trees matching CanvasItem _update_sorting().
jump_z_axis_sim.gd
Complete CharacterBody2D snippet separating structural physical ground movement (X,Y) from a mathematically simulated jumping height (Z) in a topdown game.
parallax_depth_camera.gd
Fake Depth Camera applying varying offset algorithms to completely disparate CanvasLayers based on an index to simulate 3D camera translation panning.
hitbox_depth_manager.gd
Area2D derived class that requires explicit custom Z-height overlap (1D AABB collision) prior to validating 2D triggers to stop incorrect "ground vs air" collision in 2.5D.
fake_3d_shadows.gd
Sprite2D shadow simulator exploiting Godot 4.x Transform2D matrix skew shear to project and angle shadows away from a simulated 3D sun direction on a 2D floor.
billboard_sprite_manager.gd
8-directional FPS Doom-style sprite controller isolating the simulated 3D relative angle between a moving 2D CharacterBody and a Camera2D viewpoint.
nav_region_flattening.gd
Topdown 2D pathfinding workaround allowing "aerial" units to cross walls by leveraging multiple tiered 2D Navigation Layers instead of proper 3D verticality.
ortho_to_perspective_fx.gd
Screen space CanvasItem warp Shader simulating a Mode 7 / tabletop perspective pitch. Maps top screen coordinates via division pinching.
2d_lighting_normals.gd
Automatic programmatic generation of CanvasTexture combining base albedo and baked normal maps at runtime so Sprites correctly react to 2D PointLIGHTs like 3D geometry.
model_to_sprite_bake.gd
MANDATORY for automated 3D→sprite angle baking via SubViewport. Keep body as strategy router.
grid_nav_bridge.gd
Flatten 3D nav intent onto AStarGrid2D for grid-based 2D ports (XZ → cell indices).
Dimension Reduction Strategies
Pick one row from the strategy router above — do not paste conversion tutorials in-scene.
| Strategy | Intent | Scripts | |----------|--------|
阅读完整来源 ↗