Ess-Ka / EsskaFOVDetector

Detect the vertical FOV of the main camera for VRChat.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EsskaFOVDetector

Detects the vertical FOV of the main camera for VRChat.

grafik

Usage

Add the prefab to your scene and select your preferred detection mode.

On Start Detection runs once on start for VR and desktop.

Interval Desktop Detection runs once on start for VR and desktop and than intervalled for desktop.

Manually Detection has to be started manually with the StartDetection method.

An optional text field shows the status and detected FOV.

Get the FOV

Use the DetectedFOV property on the FOVDetector component.

React to changes

Register your component to FOVDetector and add the OnFOVChange method to react to changes.

Example:

public class YourComponent : UdonSharpBehaviour {
    public FOVDetector fovDetector;

    void Start() {
        fovDetector.Register(this);
    }

    public void OnFOVChanged() {
        Debug.Log($"New FOV is {fovDetector.DetectedFOV}°");
    }
}

Layer

The prefab is set to the PlayerLocal layer because this layer is used only by the main camera. Other layers can trigger the FOV detection in mirrors or on other cameras and will return a wrong FOV value.

About

Detect the vertical FOV of the main camera for VRChat.

License:MIT License


Languages

Language:C# 100.0%