Beispiel #1
0
        private void Update()
        {
            if (isEditor || !trackBone)
            {
                return;
            }

            Vector3    targetPos;
            Quaternion targetRot;

            targetPos = player.GetBonePosition(bone);
            targetRot = player.GetBoneRotation(bone);

            if (trackPosition && trackRotation)
            {
                targetTransform.SetPositionAndRotation(targetPos, targetRot);
            }
            else if (trackPosition)
            {
                targetTransform.position = targetPos;
            }
            else
            {
                targetTransform.rotation = targetRot;
            }

            if (rotateBy.magnitude > 0)
            {
                targetTransform.Rotate(rotateBy);
            }
        }
Beispiel #2
0
        void LateUpdate()
        {
            if (isInEditor)
            {
                return;
            }

            transform.SetPositionAndRotation(playerApi.GetBonePosition(trackedBone), playerApi.GetBoneRotation(trackedBone));
        }
    private void LateUpdate()
    {
        // 追従するプレイヤーのLocalで処理をする
        if (isTracking)
        {
            // 追従オブジェクトと追従するプレイヤーとの場所の差分
            var distance = characterRoot.position - player.GetPosition();

            // ボーンの位置を反映させる
            headPoint.position = player.GetBonePosition(HumanBodyBones.Head) + distance;
            headPoint.rotation = player.GetBoneRotation(HumanBodyBones.Head);

            hipPoint.position = player.GetBonePosition(HumanBodyBones.Hips) + distance;
            hipPoint.rotation = player.GetBoneRotation(HumanBodyBones.Hips);

            lhandPoint.position = player.GetBonePosition(HumanBodyBones.LeftHand) + distance;
            lhandPoint.rotation = player.GetBoneRotation(HumanBodyBones.LeftHand);

            rhandPoint.position = player.GetBonePosition(HumanBodyBones.RightHand) + distance;
            rhandPoint.rotation = player.GetBoneRotation(HumanBodyBones.RightHand);

            lfootPoint.position = player.GetBonePosition(HumanBodyBones.LeftFoot) + distance;
            lfootPoint.rotation = player.GetBoneRotation(HumanBodyBones.LeftFoot);

            rfootPoint.position = player.GetBonePosition(HumanBodyBones.RightFoot) + distance;
            rfootPoint.rotation = player.GetBoneRotation(HumanBodyBones.RightFoot);
        }
    }
        private void Update()
        {
            if (!isRecording)
            {
                return;
            }

            if (time - beforetime > SecondsPerRecord)
            {
                if (recordAllPlayers)
                {
                    VRCPlayerApi.GetPlayers(players);
                }
                for (int i = 0; i < players.Length; i++)
                {
                    if (players[i] == null)
                    {
                        continue;
                    }
                    player = players[i];

                    string strOutputLog = "HUMR:";
                    strOutputLog += player.displayName;
                    strOutputLog += time.ToString();
                    strOutputLog += ",";
                    //hipbone = root
                    strOutputLog += player.GetBonePosition(HumanBodyBones.Hips).x.ToString("F7");
                    strOutputLog += ",";
                    strOutputLog += player.GetBonePosition(HumanBodyBones.Hips).y.ToString("F7");
                    strOutputLog += ",";
                    strOutputLog += player.GetBonePosition(HumanBodyBones.Hips).z.ToString("F7");
                    for (int j = 0; j < bonerotation.Length; j++)
                    {
                        bonerotation[j] = player.GetBoneRotation((HumanBodyBones)j);
                        strOutputLog   += ",";
                        strOutputLog   += bonerotation[j].x.ToString("F7");
                        strOutputLog   += ",";
                        strOutputLog   += bonerotation[j].y.ToString("F7");
                        strOutputLog   += ",";
                        strOutputLog   += bonerotation[j].z.ToString("F7");
                        strOutputLog   += ",";
                        strOutputLog   += bonerotation[j].w.ToString("F7");
                    }
                    Debug.Log(strOutputLog);
                    beforetime = time;
                }
            }
            time += Time.deltaTime;
        }
Beispiel #5
0
    private void Update()
    {
        timeSinceLastBlink    += Time.deltaTime;
        timeSinceLastRecharge += Time.deltaTime;

        if (timeSinceLastRecharge > cooldownRecharge)
        {
            charges += refillAmount;
            if (charges > maxCharges)
            {
                charges = maxCharges;
            }

            timeSinceLastRecharge = 0;
        }

        // TODO: Some other button might be better for this but idk which one yet.
        // If jump button is pressed.
        if ((Input.GetButtonDown("Oculus_CrossPlatform_SecondaryThumbstick") || Input.GetButtonDown("Jump")) && timeSinceLastBlink > cooldownBlink && charges > 0)
        {
            blinkDist = maxBlinkDistance;
            // TODO: This may need to be changed to avatar origin position to prevent clipping into ground with tall avatars.
            headPos = playerLocal.GetBonePosition(HumanBodyBones.Head);
            headRot = playerLocal.GetBoneRotation(HumanBodyBones.Head);
            if (Physics.Raycast(headPos, headRot * Vector3.forward, out rayHit))
            {
                if (rayHit.distance <= maxBlinkDistance)
                {
                    blinkDist = rayHit.distance;
                }
            }
            playerLocal.TeleportTo(playerLocal.GetPosition() + (headRot * Vector3.forward) * (blinkDist - destinationDistFromCollider), playerLocal.GetRotation());

            timeSinceLastBlink = 0;
            charges--;
        }
    }
 void bonesset(HumanBodyBones bone, int index, VRCPlayerApi PlayerApiref)
 {
     bonevisuals[index].position = PlayerApiref.GetBonePosition(bone);
     bonevisuals[index].rotation = PlayerApiref.GetBoneRotation(bone);
 }
Beispiel #7
0
    private void Update()
    {
        VRCPlayerApi player = Networking.LocalPlayer;

        transform.SetPositionAndRotation(player.GetBonePosition(Bone), player.GetBoneRotation(Bone));
    }