terrain-integration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTerrain Integration
地形集成
Foundation placement, slope handling, and terrain modification for building systems.
适用于建筑系统的地基放置、斜坡处理与地形修改功能。
Quick Start
快速开始
javascript
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 }javascript
import { TerrainAnalyzer } from './scripts/terrain-analyzer.js';
import { FoundationPlacer } from './scripts/foundation-placer.js';
// 分析建造位置的地形
const analyzer = new TerrainAnalyzer(terrainMesh);
const slopeData = analyzer.analyzeSlope(position, { radius: 4 });
// slopeData: { angle: 15, normal: Vector3, canBuild: true }
// 自动调平放置地基
const placer = new FoundationPlacer({
mode: 'valheim', // 或 'rust', 'ark'
maxSlope: 30,
autoLevel: true
});
const result = placer.place(foundationPiece, position, analyzer);
// result: { valid: true, height: 2.3, pillarsNeeded: 2 }Reference
参考资料
See for:
references/terrain-integration-advanced.md- Slope analysis algorithms and thresholds
- Foundation anchoring patterns (Valheim ground contact rule)
- Auto-leveling strategies
- Terrain modification networking
- Pillar generation for uneven terrain
查看 获取以下内容:
references/terrain-integration-advanced.md- 斜坡分析算法与阈值
- 地基锚固模式(Valheim地面接触规则)
- 自动调平策略
- 地形修改网络同步
- 不平坦地形的立柱生成方案
Scripts
脚本文件
- - Slope detection, buildability checks, terrain sampling
scripts/terrain-analyzer.js - - Foundation placement with Valheim/Rust/ARK modes
scripts/foundation-placer.js - - Flatten, raise, lower terrain operations
scripts/terrain-modifier.js - - Auto-generate support pillars for slopes
scripts/pillar-generator.js
- - 斜坡检测、建造可行性检查、地形采样
scripts/terrain-analyzer.js - - 支持Valheim/Rust/ARK模式的地基放置
scripts/foundation-placer.js - - 地形平整、抬升、降低操作
scripts/terrain-modifier.js - - 自动生成斜坡支撑立柱
scripts/pillar-generator.js
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
- Valheim:地面接触=100%稳定性,地基必须接触地形
- Rust:地基吸附到网格,放置后忽略地形
- ARK:灵活放置并自动生成立柱,中等斜坡容忍度
Integration
集成说明
Works with for stability calculations. Grounded foundations feed into the support graph as root nodes with maximum stability.
structural-physicsjavascript
// 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);
}可与 集成进行稳定性计算。落地的地基会作为根节点加入支撑图,并拥有最高稳定性。
structural-physicsjavascript
// 集成示例
const grounded = placer.place(foundation, pos, analyzer);
if (grounded.valid) {
foundation.isGrounded = true;
foundation.stability = 1.0; // 传入structural-physics
validator.addPiece(foundation);
}