From fb9bace145df56684e00752b23e32154b522b310 Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 24 Feb 2022 12:44:02 +0100 Subject: [PATCH] Reimplemented world_transform_changed event in chunks. This fixes chunk poitions, but only in gles3. It turns out that the transform parameter of canvas render_mesh is not implemented in gles2. --- world/default/terrain_2d_chunk_default.cpp | 2 +- world/terrain_2d_chunk.cpp | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/world/default/terrain_2d_chunk_default.cpp b/world/default/terrain_2d_chunk_default.cpp index 85aefde..73ba74a 100644 --- a/world/default/terrain_2d_chunk_default.cpp +++ b/world/default/terrain_2d_chunk_default.cpp @@ -445,7 +445,7 @@ void Terrain2DChunkDefault::free_index(const int mesh_index) { void Terrain2DChunkDefault::update_transforms() { RID empty_rid; - //Transform t = get_transform(); + //Transform2D t = get_transform(); List keys; diff --git a/world/terrain_2d_chunk.cpp b/world/terrain_2d_chunk.cpp index 587bd6a..ad94f3a 100644 --- a/world/terrain_2d_chunk.cpp +++ b/world/terrain_2d_chunk.cpp @@ -1245,14 +1245,10 @@ void Terrain2DChunk::_generation_physics_process(const float delta) { } void Terrain2DChunk::_world_transform_changed() { - Transform2D wt; + Transform2D t; + t.set_origin( Vector2(_position_x * static_cast(_size_x) * _voxel_scale, _position_z * static_cast(_size_z) * _voxel_scale)); - if (_voxel_world != NULL) { - wt = _voxel_world->get_transform(); - } - - //TODO - //set_transform(wt * Transform(Basis(), Vector3(_position_x * static_cast(_size_x) * _voxel_scale, 0, _position_z * static_cast(_size_z) * _voxel_scale))); + set_transform(t); } /*