17using System.Collections;
20#if UNITY_2019_1_OR_NEWER && INPUTSYSTEM_AVAILABLE
21using UnityEngine.InputSystem;
33 [DisallowMultipleComponent]
34#if !UNITY_2019_1_OR_NEWER || !INPUTSYSTEM_AVAILABLE
37 [DefaultExecutionOrder(-500)]
43 [DefaultExecutionOrder(500)]
65 [Obsolete(
"primaryWandSettings is deprecated, please update to use left/right based on user preference instead.")]
67 [Obsolete(
"secondaryWandSettings is deprecated, please update to use left/right based on user preference instead.")]
74 #pragma warning disable 618
77 #pragma warning restore 618
84 #pragma warning disable 618
87 #pragma warning restore 618
104 public EditorSettings editorSettings =
new EditorSettings();
127 Log.
Warn(
"Failed to send application info to the T5 Control Panel.");
138#if UNITY_2019_1_OR_NEWER && INPUTSYSTEM_AVAILABLE
142 private void OnBeforeUpdate()
145 if (UnityEditor.EditorApplication.isPaused)
150 if (
Player.scanningForPlayers)
155 Player.ScanForNewPlayers();
156 Wand.GetLatestInputs();
161 if (UnityEngine.InputSystem.LowLevel.InputState.currentUpdateType != UnityEngine.InputSystem.LowLevel.InputUpdateType.BeforeRender)
173#if !UNITY_2019_1_OR_NEWER || !INPUTSYSTEM_AVAILABLE
175 Player.ScanForNewPlayers();
176 Wand.GetLatestInputs();
185 spectatedPlayerPose.position,
186 spectatedPlayerPose.rotation);
237 Log.
Warn(
"Incompatible Tilt Five service. Please update driver package.");
248 catch (System.DllNotFoundException e)
251 "Could not connect to Tilt Five plugin for compatibility check: {0}",
255 catch (System.Exception e)
276 catch (System.DllNotFoundException e)
279 "Could not connect to Tilt Five plugin for setting max glasses: {0}",
282 catch (System.Exception e)
290#if UNITY_2019_1_OR_NEWER && INPUTSYSTEM_AVAILABLE
291 InputSystem.onBeforeUpdate += OnBeforeUpdate;
297#if UNITY_2019_1_OR_NEWER && INPUTSYSTEM_AVAILABLE
298 InputSystem.onBeforeUpdate -= OnBeforeUpdate;
324 catch (System.DllNotFoundException)
328 catch (System.Exception e)
334 [RuntimeInitializeOnLoadMethod]
337 Application.quitting +=
Quit;
345 Log.
Warn(
"No camera template detected in TiltFiveManager's glassesSettings. A camera template is required.");
358 Log.
Warn($
"Invalid spectatorSettings.spectatedPlayer [{spectatorSettings.spectatedPlayer}]. TiltFiveManager only supports one player.");
359 spectatorSettings.spectatedPlayer = highestSupportedPlayer;
458 #region ISceneInfo Implementation
482 return isActiveAndEnabled;
485 #endregion ISceneInfo Implementation
static bool SetApplicationInfo()
Vector3 gameBoardRotation
The game board rotation or focal rotational offset.
Vector3 gameBoardCenter
The game board position or focal position offset.
GameBoard currentGameBoard
The game board is the window into the game world, as well as the origin about which the glasses/wand ...
float gameBoardScale
The game board's scale multiplies the perceived size of objects in the scene.
The Glasses API and runtime.
static Camera GetLeftEye(PlayerIndex playerIndex)
static bool TryGetPreviewPose(PlayerIndex playerIndex, out Pose pose)
Attempts to get the position and orientation of the specified player's glasses, smoothed for on-scree...
static void Reset(GlassesSettings glassesSettings, SpectatorSettings spectatorSettings=null, PlayerIndex playerIndex=PlayerIndex.None)
Reset this T:TiltFive.Glasses.
static void Update(GlassesSettings glassesSettings, ScaleSettings scaleSettings, GameBoardSettings gameBoardSettings)
Updates this T:TiltFive.Glasses.
GlassesSettings encapsulates all configuration data used by the Glasses' tracking runtime to compute ...
Camera cameraTemplate
The camera used as a template for creating the eye cameras at runtime.
GlassesMirrorMode glassesMirrorMode
static void Warn(string m, params object[] list)
WARN logging function call.
static void Info(string m, params object[] list)
INFO logging function call.
static void Error(string m, params object[] list)
ERROR logging function call.
static void UnloadWorkaround()
static ServiceCompatibility GetServiceCompatibility()
static void SetMaxDesiredGlasses(byte maxCount)
Provides access to player settings and functionality.
ScaleSettings contains the scale data used to translate between Unity units and the user's physical s...
const float MIN_CONTENT_SCALE_RATIO
float contentScaleRatio
The scaling ratio relates physical distances to world-space units.
float GetScaleToUWRLD_UGBD(float gameboardScale)
PlayerIndex spectatedPlayer
The player that will have their perspective mirrored on screen.
Camera spectatorCamera
The camera used for rendering the onscreen preview.
LogSettings logSettings
The log settings.
uint GetSupportedPlayerCount()
SpectatorSettings spectatorSettings
The spectator camera's runtime configuration data.
void RefreshPlayerSettings()
bool IsActiveAndEnabled()
void RefreshSpectatorSettings()
GameBoardSettings gameBoardSettings
The game board runtime configuration data.
void OnEnable()
Called when the GameObject is enabled.
override void Awake()
Awake this instance.
WandSettings rightWandSettings
The wand runtime configuration data for the right hand wand.
void Update()
Update this instance.
PlayerSettings playerSettings
WandSettings secondaryWandSettings
bool needsDriverUpdateNotifiedOnce
float GetScaleToUWRLD_UGBD()
void LateUpdate()
Update this instance after all components have finished executing their Update() functions.
void GetLatestPoseData()
Obtains the latest pose for all trackable objects.
bool needsDriverUpdateErroredOnce
ScaleSettings scaleSettings
The scale conversion runtime configuration data.
bool NeedsDriverUpdate()
Check if a driver update is needed.
GlassesSettings glassesSettings
The glasses runtime configuration data.
WandSettings leftWandSettings
The wand runtime configuration data for the left hand wand.
WandSettings primaryWandSettings
The Wand API and runtime.
static void Update(WandSettings wandSettings, ScaleSettings scaleSettings, GameBoardSettings gameBoardSettings, PlayerIndex playerIndex=PlayerIndex.One)
Wand Settings encapsulates all configuration data used by the Wand's tracking runtime to compute the ...
ServiceCompatibility
Whether the running service is compatible.
ControllerIndex
Since wands are all physically identical (they have no "handedness"), it doesn't make sense to addres...
PlayerIndex
The Player index (e.g. Player One, Player Two, etc)