Originally posted by **constly** February 18, 2024
具体见 ant.test.features 里面的 group_test.lua ,按了G或H后,模型没有被隐藏
相关代码如下:
```
function group_test_sys:data_changed()
for _, key, press in kb_mb:unpack() do
if key == "G" and press == 0 then
group_states["group_test1"] = not group_states["group_test1"]
ig.enable_from_name("group_test1", "view_visible", group_states["group_test1"])
elseif key == "H" and press == 0 then
group_states["group_test2"] = not group_states["group_test2"]
ig.enable_from_name("group_test2", "view_visible", group_states["group_test2"])
elseif key == "B" and press == 0 then
PC:create_instance {
prefab = "/pkg/ant.resources.binary/meshes/base/ring.glb|mesh.prefab",
group = ig.groupid "group_test2",
on_ready = function(e)
local eid = e.tag['*'][1]
local ee = world:entity(eid, "scene:in")
iom.set_position(ee, math3d.vector(0, 0, 10, 1))
end
}
end
end
end
```
Discussed in https://github.com/ejoy/ant/discussions/93