30 protected Pose pose_USTAGE;
36 protected Pose pose_UWRLD;
42 protected bool isTracked =
false;
48 protected bool isConnected =
false;
59 #region Protected Functions
61 protected void Reset(TSettings settings)
72 Log.
Error(
"TrackableSettings configuration required for tracking updates.");
80 var successfullyConnected = TryCheckConnected(out isConnected) && isConnected;
81 var successfullyGotState = TryGetStateFromPlugin(out var state, out
bool poseIsValid);
83 if (successfullyConnected && successfullyGotState && poseIsValid)
86 SetPoseGameboardSpace(state, settings, scaleSettings, gameboardSettings);
91 SetInvalidPoseGameboardSpace(state, settings, scaleSettings, gameboardSettings);
94 SetPoseUnityWorldSpace(scaleSettings, gameboardSettings);
96 SetDrivenObjectTransform(settings, scaleSettings, gameboardSettings);
99 protected static Vector3 ConvertPosSTAGEToUSTAGE(Vector3 pos_STAGE)
102 return new Vector3(pos_STAGE.x, pos_STAGE.z, pos_STAGE.y);
105 protected static Pose GameboardToWorldSpace(Pose pose_GameboardSpace,
106 ScaleSettings scaleSettings, GameBoardSettings gameboardSettings)
108 float scaleToUWRLD_USTAGE = scaleSettings.GetScaleToWorldSpaceFromGameboardSpace(gameboardSettings.
gameBoardScale);
110 Vector3 pos_UWRLD = gameboardSettings.currentGameBoard.rotation *
111 (scaleToUWRLD_USTAGE * pose_GameboardSpace.position) + gameboardSettings.
gameBoardCenter;
113 Quaternion rotToUWRLD_OBJ = GameboardToWorldSpace(pose_GameboardSpace.rotation, gameboardSettings);
115 return new Pose(pos_UWRLD, rotToUWRLD_OBJ);
118 protected static Vector3 GameboardToWorldSpace(Vector3 pos_USTAGE,
119 ScaleSettings scaleSettings, GameBoardSettings gameboardSettings)
121 float scaleToUWRLD_USTAGE = scaleSettings.GetScaleToWorldSpaceFromGameboardSpace(gameboardSettings.
gameBoardScale);
123 return gameboardSettings.currentGameBoard.rotation *
124 (scaleToUWRLD_USTAGE * pos_USTAGE) + gameboardSettings.
gameBoardCenter;
127 protected static Vector3 WorldToGameboardSpace(Vector3 pos_UWRLD,
128 ScaleSettings scaleSettings, GameBoardSettings gameboardSettings)
130 float scaleToUWRLD_USTAGE = scaleSettings.GetScaleToWorldSpaceFromGameboardSpace(gameboardSettings.
gameBoardScale);
133 pos_USTAGE = Quaternion.Inverse(rotToUWRLD_USTAGE) * pos_USTAGE;
134 pos_USTAGE /= scaleToUWRLD_USTAGE;
139 protected static Quaternion GameboardToWorldSpace(Quaternion rotToUSTAGE_OBJ, GameBoardSettings gameboardSettings)
142 var rotToUWRLD_OBJ = rotToUWRLD_USTAGE * rotToUSTAGE_OBJ;
144 return rotToUWRLD_OBJ;
147 protected static Quaternion WorldToGameboardSpace(Quaternion rotToUWRLD_OBJ, GameBoardSettings gameboardSettings)
150 var rotToUSTAGE_UWRLD = Quaternion.Inverse(rotToUWRLD_USTAGE);
151 var rotToUSTAGE_OBJ = rotToUSTAGE_UWRLD * rotToUWRLD_OBJ;
153 return rotToUSTAGE_OBJ;
157 #endregion Protected Functions
160 #region Abstract Functions
218 #endregion Abstract Functions