Photon

[Photon] networkrig, networkhand, networkhead, hardwarerig, hardwarehead, hardwarehand

다모아 2023. 12. 7. 14:37

VR Shared

https://doc.photonengine.com/ko-kr/fusion/current/technical-samples/fusion-vr-shared

 

VR Shared | Photon Engine

Fusion VR Shared 는 VR 기능이 있는 멀티플레이어 게임 또는 애플리케이션의 쉽고 빠른 시작법에 대해 설명합니다. 공유 토폴로지 또는 호스트/서버 토폴로지 중 어떤 것을 선택할지는 게임 사양에

doc.photonengine.com

 


Oculus VR 세팅

CenterEyeAnchor

 


 

이 화면 구성임


 



 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HardwareRig : MonoBehaviour
{
    public HardwareHead headSet;
    public HardwareHand leftHand;
    public HardwareHand rightHand;

    public NetworkRig networkRig;

    private void Update()
    {
        this.networkRig.headSet.SetLocalPosition(this.headSet.transform.localPosition);
        this.networkRig.headSet.SetLocalRotation(this.headSet.transform.localRotation);

        this.networkRig.leftHand.SetLocalPosition(this.leftHand.transform.localPosition);
        this.networkRig.leftHand.SetLocalRotation(this.leftHand.transform.localRotation);

        this.networkRig.rightHand.SetLocalPosition(this.rightHand.transform.localPosition);
        this.networkRig.rightHand.SetLocalRotation(this.rightHand.transform.localRotation);
    }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NetworkRig : MonoBehaviour
{
    public NetworkHead headSet;
    public NetworkHand leftHand;
    public NetworkHand rightHand;

    private void Awake()
    {
        var hardwareRig = GameObject.FindObjectOfType<HardwareRig>();
        hardwareRig.networkRig = this;
    }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NetworkHead : MonoBehaviour
{
    public void SetLocalPosition(Vector3 pos)
    {
        this.transform.localPosition = pos;
    }

    public void SetLocalRotation(Quaternion rot)
    {
        this.transform.localRotation = rot;
    }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NetworkHand : MonoBehaviour
{
    public void SetLocalPosition(Vector3 pos)
    {
        this.transform.localPosition = pos;
    }

    public void SetLocalRotation(Quaternion rot)
    {
        this.transform.localRotation = rot;
    }
}