Hello there! I have these nodes (slice and sprite) that I want to duplicate, rotate and use to “touch” them:

I have already duplicated them inside init() drawing nice 8 slices of a cheese:
self.cheese = {
node = gui.get_node("cheese"),
slices = {},
}
local slice_original = gui.get_node("slice")
for i = 1, 8 do
self.cheese.slices[i] = gui.clone_tree(slice_original)
-- each slide sum rotates -45º (clockwise) starting at 45º (1 o'clock)
gui.set(self.cheese.slices[i].slice, "euler.z", -45 * (i - 1) + 45)
gui.set_enabled(self.cheese.slices[i].slice, true)
gui.set_color(self.cheese.slices[i].sprite, self.color.primary)
end
The problem comes when trying to “pick” them:
function on_input(self, action_id, action)
if action_id == touch and action.pressed and not self.solved then
for _, slice in pairs(self.cheese.slices) do
if gui.pick_node(slice.slice, action.x, action.y) then
gui.set_color(slice.sprite, vmath.vector3(1))
end
end
end
end
I expect to color just the slice picked but all of them became white.
I’ve thought different ways to make it work without cloning but I want to understand what I’m doing wrong. Thank you very much for your future response.
