Skip to content

Instantly share code, notes, and snippets.

@ForestKatsch
Last active August 10, 2020 16:43
Show Gist options
  • Save ForestKatsch/d169b6fc6d8778b6c1d9fb56e07d1a45 to your computer and use it in GitHub Desktop.
Save ForestKatsch/d169b6fc6d8778b6c1d9fb56e07d1a45 to your computer and use it in GitHub Desktop.
// Sets the origin mode for XR.
// Add this component somewhere in your scene.
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;
public class SetXROrigin : MonoBehaviour {
public TrackingOriginModeFlags originMode = TrackingOriginModeFlags.Floor;
void Start() {
List<XRInputSubsystem> subsystems = new List<XRInputSubsystem>();
SubsystemManager.GetInstances<XRInputSubsystem>(subsystems);
foreach(var subsystem in subsystems) {
subsystem.TrySetTrackingOriginMode(originMode);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment