17 using System.Collections;
20 #if UNITY_2019_1_OR_NEWER && INPUTSYSTEM_AVAILABLE
21 using UnityEngine.InputSystem;
22 using UnityEngine.InputSystem.Users;
34 [DisallowMultipleComponent]
35 #if !UNITY_2019_1_OR_NEWER || !INPUTSYSTEM_AVAILABLE
38 [DefaultExecutionOrder(-500)]
44 [DefaultExecutionOrder(500)]
66 [Obsolete(
"primaryWandSettings is deprecated, please update to use left/right based on user preference instead.")]
68 [Obsolete(
"secondaryWandSettings is deprecated, please update to use left/right based on user preference instead.")]
75 #pragma warning disable 618
78 #pragma warning restore 618
85 #pragma warning disable 618
88 #pragma warning restore 618
110 public EditorSettings editorSettings =
new EditorSettings();
136 Log.
Warn(
"Failed to set application context.");
142 Log.
Warn(
"Failed to send application info to the T5 Service.");
153 #if UNITY_2019_1_OR_NEWER && INPUTSYSTEM_AVAILABLE
157 private void OnBeforeUpdate()
160 if (UnityEditor.EditorApplication.isPaused)
165 if (
Player.scanningForPlayers)
170 Player.ScanForNewPlayers();
171 Wand.GetLatestInputs();
176 if (UnityEngine.InputSystem.LowLevel.InputState.currentUpdateType != UnityEngine.InputSystem.LowLevel.InputUpdateType.BeforeRender)
188 #if !UNITY_2019_1_OR_NEWER || !INPUTSYSTEM_AVAILABLE
190 Player.ScanForNewPlayers();
191 Wand.GetLatestInputs();
202 spectatedPlayerPose.position,
203 spectatedPlayerPose.rotation);
206 #if UNITY_2019_1_OR_NEWER && INPUTSYSTEM_AVAILABLE
207 var devices = InputUser.GetUnpairedInputDevices();
208 if (devices.Count > 0)
210 foreach (InputDevice dev
in devices)
212 if (dev is WandDevice)
216 if (headPoseRoot !=
null)
218 var playerInput = headPoseRoot.GetComponentInChildren<PlayerInput>();
220 if (playerInput !=
null && playerInput.user.valid)
222 Log.
Warn($
"Unpaired Wand Device [{((WandDevice)dev).ControllerIndex}] found and paired to Player [{((WandDevice)dev).playerIndex}].");
223 InputUser.PerformPairingWithDevice(dev, playerInput.user);
224 playerInput.user.ActivateControlScheme(
"XR");
280 Log.
Warn(
"Incompatible Tilt Five service. Please update driver package.");
291 catch (System.DllNotFoundException e)
294 "Could not connect to Tilt Five plugin for compatibility check: {0}",
298 catch (System.Exception e)
319 catch (System.DllNotFoundException e)
322 "Could not connect to Tilt Five plugin for setting max glasses: {0}",
325 catch (System.Exception e)
332 #if UNITY_2019_1_OR_NEWER && INPUTSYSTEM_AVAILABLE
333 InputSystem.onBeforeUpdate += OnBeforeUpdate;
339 #if UNITY_2019_1_OR_NEWER && INPUTSYSTEM_AVAILABLE
340 InputSystem.onBeforeUpdate -= OnBeforeUpdate;
366 catch (System.DllNotFoundException)
370 catch (System.Exception e)
376 [RuntimeInitializeOnLoadMethod]
379 Application.quitting +=
Quit;
387 Log.
Warn(
"No camera template detected in TiltFiveManager's glassesSettings. A camera template is required.");
400 Log.
Warn($
"Invalid spectatorSettings.spectatedPlayer [{spectatorSettings.spectatedPlayer}]. TiltFiveManager only supports one player.");
424 if(playerSettings ==
null)
476 if (playerSettings !=
null)
500 #region ISceneInfo Implementation
524 return isActiveAndEnabled;
527 #endregion ISceneInfo Implementation
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)
Gets the left eye camera for the specified player's glasses.
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 GameObject GetPoseRoot(PlayerIndex playerIndex)
Gets the pose root GameObject for the specified player.
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
GraphicsSettings encapsulates configuration data related to the project's graphics settings,...
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 int LogLevel
Gets or sets the logging level.
static string TAG
Gets or sets the logging tag.
Provides access to player settings and functionality.
ScaleSettings scaleSettings
GameBoardSettings gameboardSettings
WandSettings leftWandSettings
GlassesSettings glassesSettings
WandSettings rightWandSettings
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.
GlassesMirrorMode glassesMirrorMode
The spectator camera will display content on screen depending on the mirroring mode....
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()
GraphicsSettings graphicsSettings
Project-wide graphics settings related to Tilt Five.
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.
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 ...
ControllerIndex controllerIndex
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)