Multimesh Visibility ranges problem

Godot Version

4.22

Question

I cant get my multimesh visibility ranges work properly? How on earth it should be made? It seems that visibility of the mmi sits tightly in the center of the world? I have tried to move mmi.position, global_position, transform.origin. disable culling, add extra culling. But I cant get it? How this is supposed to set up? Everything else works, but visibility doesnt. I am clearly missing something. Everything is generated in code if it matters. Thanks!

edit, and some code ofcourse;
var mmi = MultiMeshInstance3D.new()
#mmi.position = center
mmi.set_name(“GrassMM”)
mmi.multimesh = MultiMesh.new()
target.add_child(mmi)

#mmi.global_position = center#get_center(mdt)
#mmi.position.y += 10
mmi.material_override = material
mmi.set_cast_shadows_setting(GeometryInstance3D.SHADOW_CASTING_SETTING_OFF)
mmi.visibility_range_begin = v_range_b
mmi.visibility_range_begin_margin = v_range_bm
mmi.visibility_range_end = 200#v_range_e# +100
mmi.visibility_range_end_margin = v_range_em
mmi.visibility_range_fade_mode = GeometryInstance3D.VISIBILITY_RANGE_FADE_SELF
mmi.ignore_occlusion_culling = true
mmi.extra_cull_margin = 6000
mmi.multimesh.instance_count = 0 # Set this to zero or you can't change the other values
mmi.multimesh.mesh = instance#.mesh
mmi.multimesh.transform_format = MultiMesh.TRANSFORM_3D
mmi.multimesh.instance_count = count

var mm_count = 0;

I try to set visibility_parent for the multimesh. But how it is supposed to do? Atleast I dont know how to get GeometryInstance3D from resource? Its just sphere mesh, mesh and node3d wont be enought. And I couldnt find from the documentation how to do this. It should be possible but… This is just a day when nothing seems to work :see_no_evil:

Invalid set index ‘visibility_parent’ (on base: ‘MultiMeshInstance3D’) with value of type ‘MeshInstance3D’.
Invalid set index ‘visibility_parent’ (on base: ‘MultiMeshInstance3D’) with value of type ‘SphereMesh’.
Invalid get index ‘GeometryInstance3D’ (on base: ‘SphereMesh’).
Invalid get index ‘GeometryInstance3D’ (on base: ‘MeshInstance3D’).

managed to get rid of the invalid errors by:
var vpp = vparent.get_path()
mmi.set_visibility_parent(vpp)
but, it still doesnt work. No matter what the vpp(visibility parent) visibility settings are. Visibility parent works as supposed, but multimesh doesnt - it doesnt show anything… Anyone?

Get it working! There wasnt really nothing wrong in the mmi. Bug was coming from error in my mmi.instance positioning code that uses meshdatatool. Dont code when too tired to do it…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.