この文書の現在のバージョンと選択したバージョンの差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
vci:sample:onuse:no5 [2022/09/05 18:02] pastatto ↷ 移動操作に合わせてリンクを書き換えました。 |
vci:sample:onuse:no5 [2023/09/28 21:11] pastatto 非推奨のAPIを書き換えてサンプルの差し替え |
||
---|---|---|---|
ライン 2: | ライン 2: | ||
> このデータは「**バーチャルキャスト1.5.1a以降**」で動作します。 | > このデータは「**バーチャルキャスト1.5.1a以降**」で動作します。 | ||
+ | [[https://developer.virtualcast.jp/vci-docs/api/classes/ExportMaterial/SetTextureOffset.html|SetTextureOffset]] を利用したマテリアル操作のサンプルVCIです。 | ||
- | サンプルデータ:[[https://seed.online/items/6a93ae195893107e661eb9aed7782f77b92c32e70b44ab6c0f18095169e74e08]] | + | === サンプルデータ === |
+ | https://virtualcast.jp/products/92a21f83e35159f9faedf0436043e6c7a3dbb75e0b1d5fef5408568578bffc01 | ||
+ | {{ :vci:sample:material:切替ポスター.zip |}} | ||
+ | |||
+ | ===== 解説 ===== | ||
アイテムを使ったときに絵柄が切り替わります。 | アイテムを使ったときに絵柄が切り替わります。 | ||
ライン 10: | ライン 15: | ||
使用しているテクスチャは以下のように3x3の画像をタイリングしたものを\\ | 使用しているテクスチャは以下のように3x3の画像をタイリングしたものを\\ | ||
- | 「**vci.assets._ALL_SetMaterialTextureOffsetFromIndex**」でUVのOffset移動を行っています。 | + | 「**vci.assets.material._ALL_SetTextureOffsetFromIndex**」でUVのOffset移動を行っています。 |
- | Material名を指定する「**vci.assets._ALL_SetMaterialTextureOffsetFromName**」でも変更可能です。\\ | + | Material名を指定する「**vci.assets.material._ALL_SetTextureOffset**」でも変更可能です。\\ |
本サンプルでは「board_5tai7」というMaterial名で指定できます。 | 本サンプルでは「board_5tai7」というMaterial名で指定できます。 | ||
ライン 22: | ライン 27: | ||
{{vci:sample:material:uv_sample.png?400|}} | {{vci:sample:material:uv_sample.png?400|}} | ||
+ | ===== VCIスクリプト ===== | ||
<file lua main.lua> | <file lua main.lua> | ||
local assets = vci.assets | local assets = vci.assets | ||
ライン 41: | ライン 47: | ||
offset.x = (1/3) * Xshift | offset.x = (1/3) * Xshift | ||
- | assets._ALL_SetMaterialTextureOffsetFromIndex(0, offset) | + | assets.material._ALL_SetTextureOffsetFromIndex(0, offset) |
end | end | ||
SetTextureOffset(count) | SetTextureOffset(count) |