バーチャルキャスト公式Wiki
メニュー
Steam版
デバイス
アセット
配信
その他
リリース情報
- wiki編集者用ページ
-
- Wikiの編集ルール
- ネームスペース一覧
デベロッパー向け
開発環境
VCI更新情報
2025/09/18 v0.44.0 2.7.4a
2025/01/21 v0.43.1 2.6.7a
2024/09/03 v0.42.1 2.6.2b
以前のアップデート履歴
2025/09/18 v0.44.0 2.7.4a
2025/01/21 v0.43.1 2.6.7a
2024/09/03 v0.42.1 2.6.2b
以前のアップデート履歴
ExportMeを利用した、キーボードの入力を受け取ってVCIを移動・回転・拡縮させるサンプルVCIです。
コンポーネントはSubItemが設定されていれば他に必要なコンポーネント等はありません。
下記のサンプルは Target という名前のSubitemが必要です。
キーボードでXZ方向の移動、UIで上昇降下、12で回転、34で拡大縮小を行います。
local _Target = vci.assets.GetTransform("Target") function update() -- 軸入力を取得する。 local axis = vci.me.GetAxisInput() -- 入力ログ if axis.x ~= 0 then print(" X : "..tostring(axis.x)) end if axis.y ~= 0 then print(" Y : "..tostring(axis.y)) end if axis.z ~= 0 then print(" Z : "..tostring(axis.z)) end -- Targetの移動 local pos = 0.01 * axis + _Target.GetLocalPosition() _Target.SetLocalPosition(pos) -- 入力取得 if vci.me.GetButtonInput(1) then print(" Button1 が押されました。") -- 回転処理 local rot = _Target.GetLocalRotation() rot = rot * Quaternion.AngleAxis(-30, Vector3.forward) _Target.SetLocalRotation(rot) end -- 入力取得 if vci.me.GetButtonInput(2) then print(" Button2 が押されました。") -- 回転処理 local rot = _Target.GetLocalRotation() rot = rot * Quaternion.AngleAxis(30, Vector3.forward) _Target.SetLocalRotation(rot) end -- 入力取得 if vci.me.GetButtonInput(3) then print(" Button3 が押されました。") -- 拡縮処理 local scale = _Target.GetLocalScale() if scale.x < 0.2 then return end scale = scale + Vector3.__new(-0.1, -0.1, -0.1) _Target.SetLocalScale(scale) end -- 入力取得 if vci.me.GetButtonInput(4) then print(" Button4 が押されました。") -- 拡縮処理 local scale = _Target.GetLocalScale() scale = scale + Vector3.__new(0.2, 0.2, 0.2) _Target.SetLocalScale(scale) end end
GetAxisには押された状態の値が常に入り続けます。
移動の処理などを行う場合は値をそのまま使えばよいですが、コンソールなどの場合は0の時は表示しないようにするのがよいかと思われます。
-- 軸入力を取得する。 local axis = vci.me.GetAxisInput() -- 入力ログ if axis.x ~= 0 then print(" X : "..tostring(axis.x)) end