Agent skill
terrain-integration
Terrain interaction systems for Three.js building games. Use when implementing slope handling, foundation anchoring (Valheim pattern), terrain modification, auto-leveling, or pillar/support generation. Integrates with structural-physics for ground-based stability.
Install this agent skill to your Project
npx add-skill https://github.com/Bbeierle12/Skill-MCP-Claude/tree/main/skills/terrain-integration
SKILL.md
Terrain Integration
Foundation placement, slope handling, and terrain modification for building systems.
Quick Start
import { TerrainAnalyzer } from './scripts/terrain-analyzer.js';
import { FoundationPlacer } from './scripts/foundation-placer.js';
// Analyze terrain at build location
const analyzer = new TerrainAnalyzer(terrainMesh);
const slopeData = analyzer.analyzeSlope(position, { radius: 4 });
// slopeData: { angle: 15, normal: Vector3, canBuild: true }
// Place foundation with auto-leveling
const placer = new FoundationPlacer({
mode: 'valheim', // or 'rust', 'ark'
maxSlope: 30,
autoLevel: true
});
const result = placer.place(foundationPiece, position, analyzer);
// result: { valid: true, height: 2.3, pillarsNeeded: 2 }
Reference
See references/terrain-integration-advanced.md for:
- Slope analysis algorithms and thresholds
- Foundation anchoring patterns (Valheim ground contact rule)
- Auto-leveling strategies
- Terrain modification networking
- Pillar generation for uneven terrain
Scripts
scripts/terrain-analyzer.js- Slope detection, buildability checks, terrain samplingscripts/foundation-placer.js- Foundation placement with Valheim/Rust/ARK modesscripts/terrain-modifier.js- Flatten, raise, lower terrain operationsscripts/pillar-generator.js- Auto-generate support pillars for slopes
Foundation Modes
- Valheim: Ground contact = 100% stability, foundations must touch terrain
- Rust: Foundations snap to grid, terrain ignored after placement
- ARK: Flexible placement with auto-pillars, moderate slope tolerance
Integration
Works with structural-physics for stability calculations. Grounded foundations feed into the support graph as root nodes with maximum stability.
// Integration example
const grounded = placer.place(foundation, pos, analyzer);
if (grounded.valid) {
foundation.isGrounded = true;
foundation.stability = 1.0; // Feed to structural-physics
validator.addPiece(foundation);
}
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
r3f-materials
Three.js materials in R3F, built-in materials (Standard, Physical, Basic, etc.), ShaderMaterial with custom GLSL, uniforms binding and animation, and material properties. Use when choosing materials, creating custom shaders, or binding dynamic uniforms.
audio-router
Router for audio domain including playback, analysis, and audio-reactive visuals. Use when implementing any audio functionality including music, sound effects, visualizers, or audio-driven animations. Routes to 3 specialized skills.
case-studies-reference
Game building mechanics case studies and decision frameworks. Use when designing building systems, evaluating trade-offs, or learning from existing games. Reference-only skill with detailed analysis of Fortnite, Rust, Valheim, Minecraft, No Man's Sky, and Satisfactory building systems.
brainstorming
Use when starting any feature, project, or design work. Guides collaborative design refinement through incremental questioning before any code is written.
shader-router
Decision framework for GLSL shader projects. Routes to specialized shader skills (fundamentals, noise, SDF, effects) based on task requirements. Use when starting a shader project or needing guidance on which shader techniques to combine.
audio-playback
Audio playback using Tone.js including players, transport, scheduling, and loading audio. Use when implementing background music, sound effects, audio synchronization, or timed audio events. Essential for any audio-enabled web application.
Didn't find tool you were looking for?