浏览代码

initial work on tracking reasons added to UX scene

/main
DanMillerDev 4 年前
当前提交
b4ee6635
共有 8 个文件被更改,包括 401 次插入38 次删除
  1. 102
      Assets/Common/Fonts/Roboto-Medium SDF.asset
  2. 219
      Assets/UX/Scenes/UXManagerScene.unity
  3. 1
      ProjectSettings/GraphicsSettings.asset
  4. 3
      ProjectSettings/ProjectSettings.asset
  5. 4
      ProjectSettings/QualitySettings.asset
  6. 91
      Assets/UX/Scripts/ARUXReasonsManager.cs
  7. 11
      Assets/UX/Scripts/ARUXReasonsManager.cs.meta
  8. 8
      Assets/ARFoundationDemos.meta

102
Assets/Common/Fonts/Roboto-Medium SDF.asset
文件差异内容过多而无法显示
查看文件

219
Assets/UX/Scenes/UXManagerScene.unity


m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.17280708, g: 0.21594499, b: 0.29788813, a: 1}
m_IndirectSpecularColor: {r: 0.17280719, g: 0.21594538, b: 0.29788864, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:

debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &249903487
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 249903490}
- component: {fileID: 249903489}
- component: {fileID: 249903488}
m_Layer: 5
m_Name: ReasonText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &249903488
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 249903487}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Tap to Place AR
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 801223ab657744a85b0e2b5ac5c1a041, type: 2}
m_sharedMaterial: {fileID: -7188733246301788310, guid: 801223ab657744a85b0e2b5ac5c1a041,
type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_outlineColor:
serializedVersion: 2
rgba: 4278190080
m_fontSize: 48
m_fontSizeBase: 48
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_textAlignment: 514
m_characterSpacing: 2
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_firstOverflowCharacterIndex: 0
m_linkedTextComponent: {fileID: 0}
m_isLinkedTextComponent: 0
m_isTextTruncated: 0
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_ignoreRectMaskCulling: 0
m_ignoreCulling: 1
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_VertexBufferAutoSizeReduction: 1
m_firstVisibleCharacter: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: -200, y: 0, z: -200, w: 3.350525}
m_textInfo:
textComponent: {fileID: 249903488}
characterCount: 15
spriteCount: 0
spaceCount: 3
wordCount: 4
linkCount: 0
lineCount: 1
pageCount: 1
materialCount: 1
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_spriteAnimator: {fileID: 0}
m_hasFontAssetChanged: 0
m_subTextObjects:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &249903489
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 249903487}
m_CullTransparentMesh: 0
--- !u!224 &249903490
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 249903487}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1208936383}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 350}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &282840810
GameObject:
m_ObjectHideFlags: 0

m_Script: {fileID: 11500000, guid: fa850fbd5b8aded44846f96e35f1a9f5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &859534124 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5977163236602945574, guid: 29251f2f7c5044cce8e7eb862b4d93ef,
type: 3}
m_PrefabInstance: {fileID: 5977163237366113874}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1015722065
GameObject:
m_ObjectHideFlags: 0

m_EditorClassIdentifier:
m_CameraManager: {fileID: 282840816}
m_BrightnessMod: 2
--- !u!1 &1208936382
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1208936383}
m_Layer: 5
m_Name: BottomOfScreenAnchor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1208936383
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1208936382}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 249903490}
m_Father: {fileID: 859534124}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1335839533
GameObject:
m_ObjectHideFlags: 0

m_DisablePlaneRendering: 1
m_PointCloudManager: {fileID: 1335839536}
m_PlaneManager: {fileID: 1335839537}
--- !u!1 &1582620436 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 5977163238016480453, guid: 29251f2f7c5044cce8e7eb862b4d93ef,
type: 3}
m_PrefabInstance: {fileID: 5977163237366113874}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1582620437
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1582620436}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8446de0774cd73441b1def01e5360fcc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ReasonDisplayText: {fileID: 249903488}
--- !u!1 &2146458540
GameObject:
m_ObjectHideFlags: 0

1
ProjectSettings/GraphicsSettings.asset


- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}

3
ProjectSettings/ProjectSettings.asset


16:9: 1
Others: 1
bundleVersion: 0.1
preloadedAssets:
- {fileID: 4800000, guid: c9f956787b1d945e7b36e0516201fc76, type: 3}
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1

4
ProjectSettings/QualitySettings.asset


excludedTargetPlatforms: []
- serializedVersion: 2
name: Ultra
pixelLightCount: 4
pixelLightCount: 1
shadows: 2
shadowResolution: 3
shadowProjection: 1

skinWeights: 4
textureQuality: 0
anisotropicTextures: 2
antiAliasing: 2
antiAliasing: 0
softParticles: 0
softVegetation: 1
realtimeReflectionProbes: 1

91
Assets/UX/Scripts/ARUXReasonsManager.cs


using System;
using TMPro;
using UnityEngine;
using UnityEngine.XR.ARFoundation;
using UnityEngine.XR.ARSubsystems;
public class ARUXReasonsManager : MonoBehaviour
{
[SerializeField]
TMP_Text m_ReasonDisplayText;
public TMP_Text reasonDisplayText
{
get => m_ReasonDisplayText;
set => m_ReasonDisplayText = value;
}
NotTrackingReason m_CurrentReason;
bool m_SessionTracking;
const string k_InitRelocalText = "Session Initializing";
const string k_MotionText = "Move the device slower";
const string k_LightText = "Move to a brighter area";
const string k_Features = "Not enough features";
const string k_Unsupported = "AR is not supported on this device";
const string k_None = "Error, not tracking";
void OnEnable()
{
ARSession.stateChanged += ARSessionOnstateChanged;
}
void Update()
{
if (!m_SessionTracking)
{
m_CurrentReason = ARSession.notTrackingReason;
ShowReason();
}
else
{
if (m_ReasonDisplayText.gameObject.activeSelf)
{
m_ReasonDisplayText.gameObject.SetActive(false);
}
}
}
void ARSessionOnstateChanged(ARSessionStateChangedEventArgs obj)
{
m_SessionTracking = obj.state == ARSessionState.SessionTracking ? true : false;
}
void ShowReason()
{
m_ReasonDisplayText.gameObject.SetActive(true);
m_ReasonDisplayText.text = ReasonString();
}
string ReasonString()
{
string retVal = String.Empty;
switch (m_CurrentReason)
{
case NotTrackingReason.Initializing:
case NotTrackingReason.Relocalizing:
retVal = k_InitRelocalText;
break;
case NotTrackingReason.ExcessiveMotion:
retVal = k_MotionText;
break;
case NotTrackingReason.InsufficientLight:
retVal = k_LightText;
break;
case NotTrackingReason.InsufficientFeatures:
retVal = k_Features;
break;
case NotTrackingReason.Unsupported:
retVal = k_Unsupported;
break;
case NotTrackingReason.None:
retVal = k_None;
break;
}
return retVal;
}
}

11
Assets/UX/Scripts/ARUXReasonsManager.cs.meta


fileFormatVersion: 2
guid: 8446de0774cd73441b1def01e5360fcc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/ARFoundationDemos.meta


fileFormatVersion: 2
guid: faeaceca7df854ff49277ef3f74f530f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存