diff options
author | dusoleil <howcansocksbereal@gmail.com> | 2022-09-20 18:52:46 -0400 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2022-09-20 18:52:46 -0400 |
commit | 743c526b46a1d1c6e0b7ef8b9b0f10b22ee43ab3 (patch) | |
tree | d7e1a2f2c0182664b7fe0e5b40d8b35a7433f8fa /world/chunk/ChunkGen.gd | |
parent | 02cbcb1a7f09c2b4d9ca89bb25cfc0a8a4354b63 (diff) | |
download | game_jam49-743c526b46a1d1c6e0b7ef8b9b0f10b22ee43ab3.tar.gz game_jam49-743c526b46a1d1c6e0b7ef8b9b0f10b22ee43ab3.zip |
Simplify and Fix Monument Code
Simplify the monument chunks to just be a bounding box with the scene origin at the center.
This allows us to automatically calculate the chunks with only the bounds provided.
It also fixes the issues with scaling and rotation.
Diffstat (limited to '')
-rw-r--r-- | world/chunk/ChunkGen.gd | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/world/chunk/ChunkGen.gd b/world/chunk/ChunkGen.gd index 994d624..4d0c94d 100644 --- a/world/chunk/ChunkGen.gd +++ b/world/chunk/ChunkGen.gd @@ -17,8 +17,9 @@ func _ready(): self.rng.seed = self._seed func setup_monuments(): - monuments.push_back(DockMonument.new(Transform(Basis().rotated(Vector3.UP,0.0),Vector3(0.0,0.0,-600.0)))) + monuments.push_back(DockMonument.new(Transform(Basis().scaled(Vector3(2.0,2.0,2.0)),Vector3(0.0,0.0,-600.0)))) monuments.push_back(DockMonument.new(Transform(Basis().rotated(Vector3.UP,PI),Vector3(0.0,0.0,600.0)))) + monuments.push_back(DockMonument.new(Transform(Basis().scaled(Vector3(1.5,1.5,1.5)).rotated(Vector3.UP,PI/4.0),Vector3(700.0,0.0,0.0)))) func rng_2dv(coords:Vector2): self.rng.seed = hash(coords) @@ -41,9 +42,9 @@ func get_monument_at_chunk(chunk_coords:Vector2): return null func gen_monument(chunk, monument): - var offset_to_origin = monument.origin_chunk - ChunkLoader.v2_coords(chunk.transform.origin) var inst = monument.scene.instance() - inst.transform.origin = ChunkLoader.v3_coords(offset_to_origin) + var offset_to_origin = monument.xform.origin - chunk.transform.origin + inst.transform.origin = offset_to_origin inst.transform.basis = monument.xform.basis chunk.add_child(inst) |