この文書の現在のバージョンと選択したバージョンの差分を表示します。
| 両方とも前のリビジョン 前のリビジョン | |||
|
vci:sample:ontrigger:no1 [2023/05/09 12:44] pastatto 統合リンク修正 |
vci:sample:ontrigger:no1 [2023/09/29 15:59] (現在) pastatto 非推奨のAPIを書き換えてサンプルの差し替え |
||
|---|---|---|---|
| ライン 1: | ライン 1: | ||
| ====== ボールが箱の中に入ったときや出たときに色を変える ====== | ====== ボールが箱の中に入ったときや出たときに色を変える ====== | ||
| - | + | [[https://developer.virtualcast.jp/vci-docs/api/events/onTriggerEnter.html | onTriggerEnter]]を使用した、アイテムがコライダーを通過したときに色が変化するサンプルです。 | |
| - | > ※この記事は「UniVCI-0.15」時点のものです。 | + | |
| === サンプルデータ === | === サンプルデータ === | ||
| https://virtualcast.jp/products/3f4a199e2408e4447ac65547a040f882f5ed085ec4ec1eb1416ed519aa2cf43e | https://virtualcast.jp/products/3f4a199e2408e4447ac65547a040f882f5ed085ec4ec1eb1416ed519aa2cf43e | ||
| + | {{ :vci:sample:material:triggerenterexit_vci.zip |}} | ||
| ===== 手順 ===== | ===== 手順 ===== | ||
| ライン 39: | ライン 38: | ||
| function onTriggerEnter(item, hit) | function onTriggerEnter(item, hit) | ||
| if item == "Ball" and hit == "Cube" then | if item == "Ball" and hit == "Cube" then | ||
| - | vci.assets._ALL_SetMaterialColorFromName("TriggerMaterial", red) | + | vci.assets.material._ALL_SetColor("TriggerMaterial", red) |
| end | end | ||
| end | end | ||
| function onTriggerExit(item, hit) | function onTriggerExit(item, hit) | ||
| if item == "Ball" and hit == "Cube" then | if item == "Ball" and hit == "Cube" then | ||
| - | vci.assets._ALL_SetMaterialColorFromName("TriggerMaterial", green) | + | vci.assets.material._ALL_SetColor("TriggerMaterial", green) |
| end | end | ||
| end | end | ||
| </file> | </file> | ||