VCIを出した際に、message(”YashiroTransformPosPlz”)にて、VCIの個別IDが共有されるので、それを使って、message(”YashiroTransformSend”)にてTransformの情報を送ると、「社」を移動させることができます。また、賽銭箱を非アクティブにすることにより、「社」を固定して設置することも可能です。

--社のTransform用メッセージ
--message[1]:VCIの個別ID、固定できないIDのため、読み込み時のみIDを共有
--message[2]:Transform用Tbl
--message[3]:コントローラーのON/OFF、OFF(非アクティブ)で疑似的な固定
--            アクティブの場合、コントローラーも移動
function yashiroTransform(sender, name, message)
    if message[1] ==vci.assets.GetInstanceId() then
        if vci.assets.GetTransform("Yashiro").IsMine then
            local tempPos = Vector3.zero
            tempPos.x = message[2]["Pos"]["x"]
            tempPos.y = message[2]["Pos"]["y"]
            tempPos.z = message[2]["Pos"]["z"]
            local tempRot = Quaternion.identity
            tempRot.x = message[2]["Rot"]["x"]
            tempRot.y = message[2]["Rot"]["y"]
            tempRot.z = message[2]["Rot"]["z"]
            tempRot.w = message[2]["Rot"]["w"]
            local tempScl = Vector3.one
            tempScl.x = message[2]["Scl"]["x"]
            tempScl.y = message[2]["Scl"]["y"]
            tempScl.z = message[2]["Scl"]["z"]
            vci.assets.GetTransform("Yashiro").SetPosition(tempPos)
            vci.assets.GetTransform("Yashiro").SetRotation(tempRot)
            vci.assets.GetTransform("Yashiro").SetLocalScale(tempScl)
            if message[3] then
                vci.assets.GetTransform("SaisenDummy").SetActive(false)
                vci.state.Set("FixState", true)
            else
                vci.assets.GetTransform("SaisenDummy").SetActive(true)
                vci.state.Set("FixState", false)
                local tempCtrlerPos = Vector3.zero
                tempCtrlerPos.x = message[4]["Pos"]["x"]
                tempCtrlerPos.y = message[4]["Pos"]["y"]
                tempCtrlerPos.z = message[4]["Pos"]["z"]
                local tempCtrlerRot = Quaternion.identity
                tempCtrlerRot.x = message[4]["Rot"]["x"]
                tempCtrlerRot.y = message[4]["Rot"]["y"]
                tempCtrlerRot.z = message[4]["Rot"]["z"]
                tempCtrlerRot.w = message[4]["Rot"]["w"]
                local tempCtrlerScl = Vector3.one
                tempCtrlerScl.x = message[4]["Scl"]["x"]
                tempCtrlerScl.y = message[4]["Scl"]["y"]
                tempCtrlerScl.z = message[4]["Scl"]["z"]
                vci.assets.GetTransform("SaisenDummy").SetPosition(tempCtrlerPos)
                vci.assets.GetTransform("SaisenDummy").SetRotation(tempCtrlerRot)
                vci.assets.GetTransform("SaisenDummy").SetLocalScale(tempCtrlerScl)
            end
        end
    end
end
vci.message.On("YashiroTransformSend", yashiroTransform)

--初回ロード時に、messageにてVCIの個別IDを共有
function update()
    if vci.state.Get("InitialSetMes") == nil then
        vci.message.Emit("YashiroTransformPosPlz", vci.assets.GetInstanceId())
        vci.state.Set("InitialSetMes", "Done")
    end
end

移動させるためのスクリプトの一例は以下の通りです。

function yashiroTransformMessage(sender, name, message)
    local tempTbl = {}
    tempTbl["Pos"] = {
        x = vci.assets.GetTransform("YashiroPos").GetPosition().x,
        y = vci.assets.GetTransform("YashiroPos").GetPosition().y,
        z = vci.assets.GetTransform("YashiroPos").GetPosition().z
    }
    tempTbl["Rot"] = {
        x = vci.assets.GetTransform("YashiroPos").GetRotation().x,
        y = vci.assets.GetTransform("YashiroPos").GetRotation().y,
        z = vci.assets.GetTransform("YashiroPos").GetRotation().z,
        w = vci.assets.GetTransform("YashiroPos").GetRotation().w
    }
    tempTbl["Scl"] = {
        x = vci.assets.GetTransform("YashiroPos").GetLocalScale().x,
        y = vci.assets.GetTransform("YashiroPos").GetLocalScale().y,
        z = vci.assets.GetTransform("YashiroPos").GetLocalScale().z
    }
    vci.message.Emit("YashiroTransformSend", {message, tempTbl, true})  
end
vci.message.On("YashiroTransformPosPlz", yashiroTransformMessage)