random width of buildings

This commit is contained in:
2020-09-09 11:44:19 +02:00
parent cdf8aa6064
commit e67c7debc5
4 changed files with 58 additions and 8 deletions
+9 -6
View File
@@ -73,9 +73,10 @@ export default {
// opacity: 0.6
// renderOrder: 0
},
size: { x: 35, y: 10, z: 10 },
position: { x: 5, y: 5, z: 0 },
label_position: { x: 5, y: 5, z: 6 },
// size and positions are defined in store project
size: { x: 0, y: 0, z: 0 },
position: { x: 0, y: 0, z: 0 },
label_position: { x: 0, y: 0, z: 0 },
color: 0xffffff,
label_canvas: null,
label_size: null,
@@ -94,10 +95,12 @@ export default {
created () {
console.log('Project created: data', this.data)
// randomize size and positions
this.size.y = 100 + Math.random() * 90
this.size.z = 10 + Math.random() * 30
// this.size.x = ... // it's
this.size = { ...this.data.size }
// this.size.y = 100 + Math.random() * 90
// this.size.z = 10 + Math.random() * 30
this.position.x = (-this.len + 1) / 2 * (this.size.x + 5) + (this.size.x + 5) * this.index
this.position.x = this.data.position.x// (-this.len + 1) / 2 * (this.size.x + 5) + (this.size.x + 5) * this.index
this.position.y = -1 * this.size.y / 2 + 10 + Math.random() * 30// -10 + Math.random() * this.size.y / 2
this.position.z = -10 + Math.random() * 10