<RealityView>
<%= for {{x, y, z}, color} <- @blocks do %>
<ModelEntity
id={"#{x},#{y},#{z}"}
mesh="box"
mesh:width={@scale / @width}
mesh:height={@scale / @height}
mesh:depth={@scale / @depth}
position:x={(x * (@scale / @width)) - (@scale / 2) + (@scale / @width / 2)}
position:y={(y * (@scale / @height)) - (@scale / 2) + (@scale / @height / 2)}
position:z={(z * (@scale / @depth)) - (@scale / 2) + (@scale / @depth / 2)}
material="simple"
material:color={color}
generateCollisionShapes
generateCollisionShapes:static
phx-click="set-block-relative"
phx-value-x={x}
phx-value-y={y}
phx-value-z={z}
>
<Group template="components">
<HoverEffectComponent />
</Group>
</ModelEntity>
<% end %>
</RealityView>
def handle_event(
"set-block-relative",
%{
"x" => x, "y" => y, "z" => z,
"_location" => %{ "x" => tap_x, "y" => tap_y, "z" => tap_z }
},
socket
) do
end