Let TerraWorld apply voxel scale to the tree. Also now the tree's scale's random range is a lot smaller.

This commit is contained in:
Relintai 2021-08-07 11:32:23 +02:00
parent f29445bdf6
commit 522242182c
2 changed files with 4 additions and 7 deletions

View File

@ -122,11 +122,8 @@ func gen_terra_chunk(chunk: TerraChunk) -> void:
tr = tr.rotated(Vector3(0, 1, 0), randf() * PI) tr = tr.rotated(Vector3(0, 1, 0), randf() * PI)
tr = tr.rotated(Vector3(1, 0, 0), randf() * 0.2 - 0.1) tr = tr.rotated(Vector3(1, 0, 0), randf() * 0.2 - 0.1)
tr = tr.rotated(Vector3(0, 0, 1), randf() * 0.2 - 0.1) tr = tr.rotated(Vector3(0, 0, 1), randf() * 0.2 - 0.1)
tr = tr.scaled(Vector3(0.9 + 0.8 - randf(), 0.9 + 0.8 - randf(), 0.9 + 0.8 - randf())) tr = tr.scaled(Vector3(0.9 + randf() * 0.2, 0.9 + randf() * 0.2, 0.9 + randf() * 0.2))
tr.origin = Vector3((x + chunk.position_x * chunk.size_x) * chunk.voxel_scale, ((val - 2) / 255.0) * chunk.world_height * chunk.voxel_scale, (z + chunk.position_z * chunk.size_z) * chunk.voxel_scale) tr.origin = Vector3((x + chunk.position_x * chunk.size_x), ((val - 2) / 255.0) * chunk.world_height, (z + chunk.position_z * chunk.size_z))
chunk.voxel_world.prop_add(tr, prop_tree, false) chunk.voxel_world.prop_add(tr, prop_tree)

View File

@ -16,4 +16,4 @@ optimization_type=2
collider_type=0 collider_type=0
offset=Vector3( 0, 0, 0 ) offset=Vector3( 0, 0, 0 )
rotation=Vector3( 0, 0, 0 ) rotation=Vector3( 0, 0, 0 )
scale=Vector3( 3, 3, 3 ) scale=Vector3( 1, 1, 1 )