====== A poster that changes texture when used ====== \\ > This data works with "**Virtual Cast 1.5.1a and later**". === Example data === https://virtualcast.jp/products/92a21f83e35159f9faedf0436043e6c7a3dbb75e0b1d5fef5408568578bffc01 You can switch the texture by pressing the grip button. {{vci:sample:material:board.png?400|}} As shown in the image below, prepare a 3-by-3 texture and use\\ **vci.assets._ALL_SetMaterialTextureOffsetFromIndex** to shift the UV offset. The same change can be done using **vci.assets._ALL_SetMaterialTextureOffsetFromName** which specifies a Material by its name.\\ The material in the example can be specified by the name "board_5tai7". {{vci:sample:material:board_5tai7.png?400|}} The UV of the picture side of the poster is set to a cell of the 3-by-3 matrix grid.\\ (To set the UV, use 3D modeling software like blender and Maya) {{vci:sample:material:uv_sample.png?400|}} local assets = vci.assets local count = 0 if vci.state.Get("COUNT") then count = vci.state.Get("COUNT") end local TOTAL = 6 function SetTextureOffset( count ) local offset = Vector2.zero -- y shift local Yshift = math.floor(count / 3) offset.y = -(1/3) * Yshift -- x shift local Xshift = count % 3 offset.x = (1/3) * Xshift assets._ALL_SetMaterialTextureOffsetFromIndex(0, offset) end SetTextureOffset(count) function onUse(use) if count >= TOTAL-1 then count = 0 else count = count + 1 end vci.state.Set("COUNT", count) SetTextureOffset(count) end