Fix: add init() method to Landscape class
This commit is contained in:
1 parent
bc27629903
commit
a3fae177fa
1 file changed
+10
@@ -70,6 +70,16 @@
|
|||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
const spacing = 40;
|
||||||
|
for (let x = -200; x <= 200; x += spacing) {
|
||||||
|
for (let z = -200; z <= 200; z += spacing) {
|
||||||
|
const y = Math.sin(x / 30) * 20 + Math.cos(z / 30) * 20 + Math.random() * 10;
|
||||||
|
this.points.set(`${x},${z}`, new Point3D(x, y, z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getKey(x, z) {
|
getKey(x, z) {
|
||||||
return `${Math.round(x / this.gridSize)},${Math.round(z / this.gridSize)}`;
|
return `${Math.round(x / this.gridSize)},${Math.round(z / this.gridSize)}`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user