バーチャルキャスト公式Wiki
メニュー
配信
その他
リリース情報
安定版
ベータ版
Quest版
- wiki編集者用ページ
-
安定版
ベータ版
Quest版
1.8.2aから、マテリアル制御系の関数が追加されました。vci.assets(ExportAssets)にもマテリアル操作系の関数がありますが、今後はExportMaterialに移行する予定ですので、こちらを優先してご使用ください。
[EmbeddedScriptWorkspace]フォルダ内の[types.lua]を開くと一覧を確認できます。
_ALL_
を含むメソッド(他のクライアントでも実行されます)
名前 | 説明 |
---|---|
_ALL_SetColorFromIndex: fun(index: number, color: Color) | 番号を指定してColorを設定します。 |
_ALL_SetColor: fun(name: string, color: Color) fun(name: string): Vector2 | 名前を指定してColorを設定します。 |
_ALL_SetEmissionColorFromIndex: fun(index: number, color: Color) | 番号を指定してEmissionColorを設定します。 |
_ALL_SetEmissionColor: fun(name: string, color: Color) | 名前を指定してEmissionColorを設定します。 |
_ALL_SetTextureOffsetFromIndex: fun(index: number, offset: Vector2) | 番号を指定してTextureOffsetを設定します。 |
_ALL_SetTextureOffset: fun(name: string, offset: Vector2) | 名前を指定してTextureOffsetを設定します。 |
_ALL_SetTextureFromIndex: fun(index: number, textureId: string) | 番号を指定してTextureを設定します。 |
_ALL_SetTexture: fun(name: string, textureId: string) | 名前を指定してTextureを設定します。 |
_ALL_ResetFromIndex: fun(index: number) | 番号を指定して初期状態にリセットします。 |
_ALL_Reset: fun(name: string) | 名前を指定して初期状態にリセットします。 |
GetNames: fun(): usertype
サンプル
function onUse(use) for key, value in pairs(vci.assets.material.GetNames()) do print(key.. ' = ' ..value) end end
実行結果
"1 = Default-Material" "2 = Cube-Material" "3 = Test-Material"
説明
マテリアル名の一覧を取得します。
GetColorFromIndex: fun(index: number): Color
サンプル
function onUse(use) print(vci.assets.material.GetColorFromIndex(1)) end
実行結果
RGBA(0.500, 0.500, 0.500, 1.000)
説明
番号を指定してColorを取得します。
GetColor: fun(name: string): Color
サンプル
function onUse(use) print(vci.assets.material.GetColor("Cube-Material")) end
実行結果
RGBA(0.500, 0.500, 0.500, 1.000)
説明
名前を指定してColorを取得します。
GetEmissionColorFromIndex: fun(index: number): Color
サンプル
function onUse(use) print(vci.assets.material.GetEmissionColorFromIndex(1)) end
実行結果
RGBA(0.000, 0.000, 0.000, 1.000)
説明
番号を指定してEmissionColorを取得します。
GetEmissionColor: fun(name: string): Color
サンプル
function onUse(use) print(vci.assets.material.GetEmissionColor("Cube-Material")) end
実行結果
RGBA(0.000, 0.000, 0.000, 1.000)
説明
名前を指定してEmissionColorを取得します。
GetTextureOffsetFromIndex: fun(index: number): Vector2
サンプル
function onUse(use) print(vci.assets.material.GetTextureOffsetFromIndex(1)) end
実行結果
(0.0, 0.0)
説明
番号を指定してTextureOffsetを取得します。
GetTextureOffset: fun(name: string): Vector2
サンプル
function onUse(use) print(vci.assets.material.GetTextureOffset("Cube-Material")) end
実行結果
(0.0, 0.0)
説明
名前を指定してTextureOffsetを取得します。
SetColorFromIndex: fun(index: number, color: Color)
サンプル
function onUse(use) vci.assets.material.SetColorFromIndex(1, Color.red) end
実行結果
index番号1番のマテリアルのColorを赤に設定します。
説明
番号を指定してColorを設定します。
SetColor: fun(name: string, color: Color) fun(name: string): Vector2
サンプル
function onUse(use) vci.assets.material.SetColor("Cube-Material", Color.blue) end
実行結果
マテリアル名がCube-MaterialのColorを青に設定します。
説明
名前を指定してColorを設定します。
SetEmissionColorFromIndex: fun(index: number, color: Color)
サンプル
function onUse(use) vci.assets.material.SetEmissionColorFromIndex(1, Color.red) end
実行結果
index番号1番のマテリアルのEmissionColorを赤に設定します。
説明
番号を指定してEmissionColorを設定します。
SetEmissionColor: fun(name: string, color: Color)
サンプル
function onUse(use) vci.assets.material.SetEmissionColor("Cube-Material", Color.blue) end
実行結果
マテリアル名がCube-MaterialのEmissionColorを青に設定します。
説明
名前を指定してEmissionColorを設定します。
SetTextureOffsetFromIndex: fun(index: number, offset: Vector2)
サンプル
function onUse(use) if count == 9 then count = 0 else count = count + 1 end SetCounterOffset(count) end function SetCounterOffset(count) local offset = Vector2.zero -- y shift local Yshift = math.floor(count / 4) offset.y = -0.25 * Yshift -- x shift local Xshift = count % 4 offset.x = 0.25 * Xshift vci.assets.material.SetTextureOffsetFromIndex(1, offset) end
実行結果
クリックするごとにTextureOffsetをずらします。サンプルでは4*4枚の画像まで使用できますが、10枚だけ使用しています。
説明
番号を指定してTextureOffsetを設定します。
SetTextureOffset: fun(name: string, offset: Vector2)
サンプル
function onUse(use) local offset = Vector2.zero offset.y = -0.25 offset.x = 0.25 * Xshift vci.assets.material.SetTextureOffsetFromIndex("PlaneMaterial", offset) end
実行結果
マテリアル名が"PlaneMaterial"であるTextureのOffsetを(0.25, -0.25)に設定しています。
説明
名前を指定してTextureOffsetを設定します。
SetTextureFromIndex: fun(index: number, textureId: string)
番号 index
を指定したマテリアルに対して、指定のテクスチャ textureId
を適用します。
詳しい説明は SetTexture をご覧ください。
SetTexture: fun(name: string, textureId: string)
名前 name
を指定したマテリアルに対して、指定のテクスチャ textureId
を適用します。
ID | 説明 |
---|---|
_SYS_NULL | テクスチャの指定が空の状態 |
_SYS_DEFAULT | このマテリアルのデフォルトのテクスチャ |
GetCameraPreviewTextureで得られるID | 写真撮影用カメラのプレビューテクスチャ |
SetOnTakePhotoCallbackで得られるID | 写真撮影用カメラの写真テクスチャ |
function onUse(use) -- Use するとテクスチャが無くなる vci.assets.material.SetTexture("PlaneMaterial", "_SYS_NULL") end function onUnuse(use) -- Unuse するとテクスチャがデフォルトに戻る vci.assets.material.SetTexture("PlaneMaterial", "_SYS_DEFAULT") end
ResetFromIndex: fun(index: number)
サンプル
function onUse(use) vci.assets.material.ResetFromIndex(1) end
実行結果
index番号1番のマテリアルを初期状態にします。
説明
番号を指定して初期状態にリセットします。
Reset: fun(name: string)
サンプル
function onUse(use) vci.assets.material.Reset("Cube-Material") end
実行結果
マテリアル名が"Cube-Material"のマテリアルを初期状態にします。
説明
名前を指定して初期状態にリセットします。