예제 #1
0
        void Start()
        {
            //ExternalReceiverにキー操作を登録
            exrcv    = GetComponent <EVMC4U.ExternalReceiver>();
            inputrcv = GetComponentInChildren <EVMC4U.InputReceiver>();

            inputrcv.ControllerInputAction.AddListener(ControllerInputEvent);
            inputrcv.KeyInputAction.AddListener(KeyInputEvent);

            //ブレ防止用にフィルタを設定
            exrcv.BonePositionFilterEnable = true;
            exrcv.BoneRotationFilterEnable = true;
            exrcv.BoneFilter = NonHoldFilter;

            //手のボーンを取得
            var anim = exrcv.Model.GetComponent <Animator>();

            leftHand  = anim.GetBoneTransform(HumanBodyBones.LeftHand);
            rightHand = anim.GetBoneTransform(HumanBodyBones.RightHand);

            //左手当たり判定スフィア生成
            leftSphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            leftSphere.transform.parent        = leftHand;
            leftSphere.transform.localPosition = new Vector3(-offset, 0f, 0f);
            leftSphere.transform.localScale    = new Vector3(size, size, size);

            //左手当たり判定スフィアコライダー設定
            var leftCollider = leftSphere.GetComponent <Collider>();

            //コライダーは反応のみで衝突しない
            leftCollider.isTrigger = true;

            //左手当たり判定物理演算追加
            leftRigidBody = leftSphere.AddComponent <Rigidbody>();
            //物理は反応のみで演算しない
            leftRigidBody.isKinematic = true;

            //左手当たり判定ヘルパー追加
            leftHelper = leftSphere.AddComponent <HandCatch_Helper>();

            //右手当たり判定スフィア生成
            rightSphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            rightSphere.transform.parent        = rightHand;
            rightSphere.transform.localPosition = new Vector3(offset, 0f, 0f);
            rightSphere.transform.localScale    = new Vector3(size, size, size);

            //右手当たり判定スフィアコライダー設定
            var rightCollider = rightSphere.GetComponent <Collider>();

            //コライダーは反応のみで衝突しない
            rightCollider.isTrigger = true;

            //右手当たり判定物理演算追加
            rightRigidBody = rightSphere.AddComponent <Rigidbody>();
            //物理は反応のみで演算しない
            rightRigidBody.isKinematic = true;

            //右手当たり判定ヘルパー追加
            rightHelper = rightSphere.AddComponent <HandCatch_Helper>();
        }
예제 #2
0
    void Start()
    {
        externalReceiver = GetComponent <EVMC4U.ExternalReceiver>();

        client = GetComponent <SEDSS_Client>();
        client.SetAddress(Address);
        client.SetPassword(password);

        if (externalReceiver != null)
        {
            client.Download(id, (data, id) =>
            {
                externalReceiver?.LoadVRMFromData(data);
                Debug.Log("Download OK id:" + id);
            }, (e, id) => {
                Error = e;
                Debug.Log("Download Error id:" + id);
            });
        }

        if (File.Exists(UploadFilePath))
        {
            byte[] data = File.ReadAllBytes(UploadFilePath);
            Debug.Log(data.Length);
            client.Upload(data, id, (id) =>
            {
                Debug.Log("Upload OK id:" + id);
            }, (e, id) =>
            {
                Error = e;
                Debug.Log("Upload Error id:" + id);
            });
        }
    }
예제 #3
0
    void Start()
    {
        externalReceiver = GetComponent <EVMC4U.ExternalReceiver>();

        server = GetComponent <SEDSS_Server>();
        server.SetPassword(password);
        server.StartServer();

        server.OnDownloadRequest = (id) => {
            Debug.Log("Server responced");
            return(File.ReadAllBytes(SendFilePath));
        };

        server.OnDataUploaded = (data, id) => {
            Debug.Log("Server received");
            externalReceiver?.LoadVRMFromData(data);
        };
    }