Fix transition meshes not removed from the world
This commit is contained in:
parent
8f243f6121
commit
aad2f0df2d
@ -102,6 +102,19 @@ void VoxelMeshBlockVLT::set_transition_mesh(Ref<Mesh> mesh, int side, DirectMesh
|
||||
}
|
||||
}
|
||||
|
||||
void VoxelMeshBlockVLT::set_world(Ref<World3D> p_world) {
|
||||
if (_world != p_world) {
|
||||
_world = p_world;
|
||||
|
||||
// To update world. I replaced visibility by presence in world because Godot 3 culling performance is horrible
|
||||
_set_visible(_visible && _parent_visible);
|
||||
|
||||
if (_static_body.is_valid()) {
|
||||
_static_body.set_world(*p_world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VoxelMeshBlockVLT::set_visible(bool visible) {
|
||||
if (_visible == visible) {
|
||||
return;
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
VoxelMeshBlockVLT(const Vector3i bpos, unsigned int size, unsigned int p_lod_index);
|
||||
~VoxelMeshBlockVLT();
|
||||
|
||||
void set_world(Ref<World3D> p_world);
|
||||
void set_visible(bool visible);
|
||||
bool update_fading(float speed);
|
||||
|
||||
|
@ -8,6 +8,9 @@
|
||||
#include "../util/godot/direct_static_body.h"
|
||||
#include "../util/ref_count.h"
|
||||
#include "../util/span.h"
|
||||
|
||||
#include <scene/resources/world_3d.h>
|
||||
|
||||
#include <atomic>
|
||||
|
||||
class Node3D;
|
||||
|
Loading…
x
Reference in New Issue
Block a user