Attention
Topic was automatically imported from the old Question2Answer platform.
Asked By
dydokamil
What I’m trying to accomplish:
I want players to be able to see nodes MeshInstance1
, MeshInstance2
, and GridMap1
when they enter the default mode - A
.
In mode B
some nodes should disappear - only MeshInstance2
and GridMap1
should be visible
I tried doing it with Camera’s cull_mask
layers:
MeshInstance1
is visible in layer 1
MeshInstance2
is visible in layer 1 and layer 2
Now the only problem is with GridMap. As soon as I disable Camera’s first layer the GridMap disappears. GridMap is only visible in the first layer.
Is it possible to solve without using cull_mask
?
In my MeshLibrary there’s only one tile which MeshInstance’s cull_mask
is set to true
(enabled) for all layers.
system
October 13, 2020, 12:40am
2
Reply From:
jamie-pate
It looks like grid_map.cpp never calls VisualServerScene::instance_set_layer_mask() which means all the multimeshinstances that a gridmap adds to the scene will always have layer_mask == 1
as per the constructor for InstanceBase() in rasterizer.h
This means that you can A layer for gridmaps, but it has to be layer 1 T_T
virtual void base_removed() = 0;
virtual void base_changed(bool p_aabb, bool p_materials) = 0;
InstanceBase() :
dependency_item(this) {
base_type = VS::INSTANCE_NONE;
cast_shadows = VS::SHADOW_CASTING_SETTING_ON;
receive_shadows = true;
visible = true;
depth_layer = 0;
layer_mask = 1;
baked_light = false;
redraw_if_visible = false;
lightmap_capture = NULL;
}
};
virtual RID light_instance_create(RID p_light) = 0;
virtual void light_instance_set_transform(RID p_light_instance, const Transform &p_transform) = 0;
virtual void light_instance_set_shadow_transform(RID p_light_instance, const CameraMatrix &p_projection, const Transform &p_transform, float p_far, float p_split, int p_pass, float p_bias_scale = 1.0) = 0;
virtual void light_instance_mark_visible(RID p_light_instance) = 0;
it.index = idx;
it.transform = F->get().first;
it.key = F->get().second;
mmi.items.push_back(it);
#endif
idx++;
}
RID instance = VS::get_singleton()->instance_create();
VS::get_singleton()->instance_set_base(instance, mm);
if (is_inside_tree()) {
VS::get_singleton()->instance_set_scenario(instance, get_world()->get_scenario());
VS::get_singleton()->instance_set_transform(instance, get_global_transform());
}
mmi.multimesh = mm;
mmi.instance = instance;
g.multimesh_instances.push_back(mmi);
I’ve created an issue
opened 07:35PM - 12 Oct 20 UTC
closed 07:09PM - 12 Nov 20 UTC
bug
archived
topic:rendering
<!-- Please search existing issues for potential duplicates before filing yours:…
https://github.com/godotengine/godot/issues?q=is%3Aissue
-->
**Godot version:**
3.2-stable
**OS/device including version:**
any
**Issue description:**
layer_mask is always 1 in gridmap multimeshinstances
**Steps to reproduce:**
Create a gridmap, there's no layer property!
**Minimal reproduction project:**
[GridMapLayers.zip](https://github.com/godotengine/godot/files/5367145/GridMapLayers.zip)