1
0
mirror of https://projects.caleb-brown.dev/UDRI-XRT/UDRIGEEKCup2024.git synced 2025-01-22 07:08:51 -05:00

WIP: Caleb's updates

This commit is contained in:
cbrown 2024-04-18 15:14:32 -04:00
parent c4d3ede2fb
commit 4da527a9e6
11 changed files with 661 additions and 100 deletions

View File

@ -0,0 +1,132 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: UnlitBlack
m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 0, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
--- !u!114 &372837915718470889
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b7459c4f18f7640e993cc6e285ead2d2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -16,11 +16,14 @@ namespace MAVRIC.GEEEKCup.Samples.QRCode
[SerializeField] private LogLevel logLevel = LogLevel.Warning;
[SerializeField] private ARTrackedImageManager trackedImageManager;
[SerializeField] private GameObjectReference parentObject;
// [SerializeField] private GameObjectReference parentObject;
[SerializeField] private GameObject[] arPrefabs;
[SerializeField] private float3 scaleFactor = new (0.1f, 0.1f, 0.1f);
[Tooltip("Parent object for all ARObjects. DO NOT SET MANUALLY.")]
[SerializeField] private Transform parentObject;
private Dictionary<string, GameObject> arObjects = new ();
private void Awake()
@ -33,9 +36,9 @@ namespace MAVRIC.GEEEKCup.Samples.QRCode
}
}
if (parentObject?.Value == null)
if (parentObject == null)
{
parentObject.Value = gameObject;
parentObject = gameObject.transform;
}
}
@ -71,7 +74,7 @@ namespace MAVRIC.GEEEKCup.Samples.QRCode
foreach (GameObject arObject in arPrefabs)
{
GameObject newARObject = Instantiate(arObject, Vector3.zero, Quaternion.identity);
newARObject.transform.SetParent(parentObject.Value.transform);
newARObject.transform.SetParent(parentObject, false);
newARObject.SetActive(false);
newARObject.name = arObject.name;
@ -110,12 +113,12 @@ namespace MAVRIC.GEEEKCup.Samples.QRCode
if (arPrefabs != null)
{
GameObject goARObject = arObjects[name];
goARObject.transform.SetParent(parentObject.Value.transform);
goARObject.transform.SetParent(parentObject, false);
goARObject.SetActive(true);
goARObject.transform.position = newPosition;
goARObject.transform.position = new float3(newPosition.x, parentObject.position.y, newPosition.z);
goARObject.transform.localScale = newScale;
goARObject.transform.localRotation = newRotation;
goARObject.transform.rotation = newRotation;
foreach (GameObject go in arObjects.Values)
{
@ -127,5 +130,18 @@ namespace MAVRIC.GEEEKCup.Samples.QRCode
}
}
}
public void SetParentObject(GameObject parent)
{
parentObject = parent.transform;
foreach (var (_, value)in arObjects)
{
var tempPosition = new float3(value.transform.position);
value.transform.SetParent(parentObject, false);
value.transform.localPosition = new float3(tempPosition.x, 0f, tempPosition.z);
}
}
}
}

View File

@ -16,7 +16,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &3754031847140804977
Transform:
m_ObjectHideFlags: 0

View File

@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.18028326, g: 0.22571333, b: 0.30692202, a: 1}
m_IndirectSpecularColor: {r: 0.18028373, g: 0.22571398, b: 0.30692294, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
@ -805,7 +805,7 @@ Transform:
m_GameObject: {fileID: 405067317}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1.1176, z: 0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -962,6 +962,247 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 626644878}
m_CullTransparentMesh: 1
--- !u!1 &708576443
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 708576444}
- component: {fileID: 708576450}
- component: {fileID: 708576449}
- component: {fileID: 708576448}
- component: {fileID: 708576447}
- component: {fileID: 708576446}
- component: {fileID: 708576445}
m_Layer: 0
m_Name: AR Default Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &708576444
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708576443}
serializedVersion: 2
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1114330154}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!120 &708576445
LineRenderer:
serializedVersion: 2
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708576443}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10306, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Positions:
- {x: 0, y: 0, z: 0}
- {x: 0, y: 0, z: 1}
m_Parameters:
serializedVersion: 3
widthMultiplier: 1
widthCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0.005
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
colorGradient:
serializedVersion: 2
key0: {r: 0, g: 0, b: 0, a: 1}
key1: {r: 0, g: 0, b: 0, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2
m_NumAlphaKeys: 2
numCornerVertices: 4
numCapVertices: 4
alignment: 0
textureMode: 0
textureScale: {x: 1, y: 1}
shadowBias: 0.5
generateLightingData: 0
m_MaskInteraction: 0
m_UseWorldSpace: 0
m_Loop: 1
m_ApplyActiveColorSpace: 1
--- !u!23 &708576446
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708576443}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: f1a110d32af21aa4d872c707dfcc6043, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &708576447
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708576443}
m_Mesh: {fileID: 0}
--- !u!64 &708576448
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708576443}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 5
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 0}
--- !u!114 &708576449
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708576443}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3d180956a54db4646a1c6342921672ad, type: 3}
m_Name:
m_EditorClassIdentifier:
m_TrackingStateVisibilityThreshold: 1
m_HideSubsumed: 1
--- !u!114 &708576450
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708576443}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f66da7470dce8f4d821d71dd2b1d4ac, type: 3}
m_Name:
m_EditorClassIdentifier:
m_DestroyOnRemoval: 1
m_VertexChangedThreshold: 0.01
--- !u!1 &727433014
GameObject:
m_ObjectHideFlags: 0
@ -1007,10 +1248,9 @@ GameObject:
- component: {fileID: 741148538}
- component: {fileID: 741148541}
- component: {fileID: 741148543}
- component: {fileID: 741148547}
- component: {fileID: 741148546}
- component: {fileID: 741148545}
- component: {fileID: 741148544}
- component: {fileID: 741148546}
m_Layer: 0
m_Name: XR Origin (XR Rig)
m_TagString: Untagged
@ -1108,10 +1348,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
trackedImageManager: {fileID: 741148541}
raycastManager: {fileID: 741148547}
planeManager: {fileID: 741148545}
anchorManager: {fileID: 741148546}
objectToPlace: {fileID: 6139534651665677761}
objectToPlace: {fileID: 6139534651665677763}
--- !u!114 &741148545
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1124,8 +1362,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: e1760703bbd54c04488a8d10600262ab, type: 3}
m_Name:
m_EditorClassIdentifier:
m_PlanePrefab: {fileID: 0}
m_DetectionMode: -1
m_PlanePrefab: {fileID: 708576443}
m_DetectionMode: 1
--- !u!114 &741148546
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1135,23 +1373,14 @@ MonoBehaviour:
m_GameObject: {fileID: 741148537}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 728ad7fae8e460a4ba41265c7308d757, type: 3}
m_Script: {fileID: 11500000, guid: b15f82cc229284894964d2d30806969d, type: 3}
m_Name:
m_EditorClassIdentifier:
m_AnchorPrefab: {fileID: 0}
--- !u!114 &741148547
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 741148537}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fa17d122634046b4a8e23048891fafc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_RaycastPrefab: {fileID: 0}
m_HumanSegmentationStencilMode: 0
m_HumanSegmentationDepthMode: 0
m_EnvironmentDepthMode: 1
m_EnvironmentDepthTemporalSmoothing: 1
m_OcclusionPreferenceMode: 0
--- !u!1 &815298830
GameObject:
m_ObjectHideFlags: 0
@ -2186,6 +2415,8 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2125492266}
- {fileID: 1791481453}
- {fileID: 708576444}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1114330155
@ -2209,19 +2440,13 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1114330151}
m_Enabled: 0
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ecb22d2c87e61499cbc8fdc37392f22e, type: 3}
m_Name:
m_EditorClassIdentifier:
logLevel: 2
trackedImageManager: {fileID: 741148541}
parentObject:
_usage: 2
_value: {fileID: 0}
_constant: {fileID: 0}
_variable: {fileID: 11400000, guid: 03debcbab0da04aa1a802a4cbc116950, type: 2}
_variableInstancer: {fileID: 0}
arPrefabs:
- {fileID: 3226870177902982147, guid: 9f2d30a7454ef4eba9169d4c4b5da360, type: 3}
- {fileID: 8130164210984699379, guid: a857efe212a8a43f89a533de0e486b71, type: 3}
@ -2229,6 +2454,90 @@ MonoBehaviour:
x: 1
y: 1
z: 1
parentObject: {fileID: 0}
--- !u!1001 &1245717078
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1424119414301866611}
m_Modifications:
- target: {fileID: 1273508384157506, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
propertyPath: m_Name
value: TransformDebugAxes
objectReference: {fileID: 0}
- target: {fileID: 1273508384157506, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
propertyPath: m_Layer
value: 29
objectReference: {fileID: 0}
- target: {fileID: 1298767457708356, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
propertyPath: m_Layer
value: 29
objectReference: {fileID: 0}
- target: {fileID: 1312820055641268, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
propertyPath: m_Layer
value: 29
objectReference: {fileID: 0}
- target: {fileID: 1475385274619790, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
propertyPath: m_Layer
value: 29
objectReference: {fileID: 0}
- target: {fileID: 1642828159801702, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
propertyPath: m_Layer
value: 29
objectReference: {fileID: 0}
- target: {fileID: 4364731056812884, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4364731056812884, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4364731056812884, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4364731056812884, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4364731056812884, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4364731056812884, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4364731056812884, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4364731056812884, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4364731056812884, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4364731056812884, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 22b5884c8772b654489e4ed1d6987802, type: 3}
--- !u!4 &1245717079 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4364731056812884, guid: 22b5884c8772b654489e4ed1d6987802,
type: 3}
m_PrefabInstance: {fileID: 1245717078}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1454802594
GameObject:
m_ObjectHideFlags: 0
@ -2665,6 +2974,77 @@ Canvas:
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!1 &1791481452
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1791481453}
- component: {fileID: 1791481454}
m_Layer: 0
m_Name: Listeners
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1791481453
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1791481452}
serializedVersion: 2
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1114330154}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1791481454
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1791481452}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7bf1607e7be0499885b187311bc83f2, type: 3}
m_Name:
m_EditorClassIdentifier:
_developerDescription:
_unityEventResponse:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1114330156}
m_TargetAssemblyTypeName: MAVRIC.GEEEKCup.Samples.QRCode.TrackedImageChanged,
MAVRIC.GEEEKCup.Samples.QRCode
m_MethodName: SetParentObject
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
_actionResponses: []
_conditions: []
_operator: 0
_replayEventBufferOnRegister: 1
_eventReference:
_usage: 2
_event: {fileID: 0}
_eventInstancer: {fileID: 0}
_variable: {fileID: 11400000, guid: 03debcbab0da04aa1a802a4cbc116950, type: 2}
_variableInstancer: {fileID: 0}
--- !u!1 &1821000983
GameObject:
m_ObjectHideFlags: 0
@ -3248,6 +3628,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1245717079}
- {fileID: 1839924536}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -3261,6 +3642,7 @@ GameObject:
m_Component:
- component: {fileID: 1424119414301866611}
- component: {fileID: 6139534651665677762}
- component: {fileID: 6139534651665677763}
m_Layer: 0
m_Name: SpawnPoint
m_TagString: Untagged
@ -3287,6 +3669,19 @@ MonoBehaviour:
_variable: {fileID: 11400000, guid: 03debcbab0da04aa1a802a4cbc116950, type: 2}
_variableInstancer: {fileID: 0}
nullOnDisable: 1
--- !u!114 &6139534651665677763
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6139534651665677761}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: eb898793194e03f4bb10dba03ec2cb70, type: 3}
m_Name:
m_EditorClassIdentifier:
m_DestroyOnRemoval: 1
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0

View File

@ -10,67 +10,62 @@ namespace MAVRIC.GEEKCup
public class ImageTrackingObjectPlacer : MonoBehaviour
{
[SerializeField] private ARTrackedImageManager trackedImageManager;
[SerializeField] private ARRaycastManager raycastManager;
[SerializeField] private ARPlaneManager planeManager;
[SerializeField] private ARAnchorManager anchorManager;
[SerializeField] private GameObject objectToPlace;
[SerializeField] private ARAnchor objectToPlace;
void OnEnable()
{
trackedImageManager.trackedImagesChanged += OnTrackedImagesChanged;
CheckForAnchor();
// trackedImageManager.trackedImagesChanged += OnTrackedImagesChanged;
planeManager.planesChanged += OnPlanesChanged;
ManagerCheck();
}
private void OnPlanesChanged(ARPlanesChangedEventArgs eventArgs)
{
foreach (var plane in eventArgs.added)
{
AttachObjectToAnchor(plane);
}
foreach (var plane in eventArgs.updated)
{
AttachObjectToAnchor(plane);
}
}
void OnDisable()
{
trackedImageManager.trackedImagesChanged -= OnTrackedImagesChanged;
// trackedImageManager.trackedImagesChanged -= OnTrackedImagesChanged;
planeManager.planesChanged -= OnPlanesChanged;
}
void OnTrackedImagesChanged(ARTrackedImagesChangedEventArgs eventArgs)
{
// void OnTrackedImagesChanged(ARTrackedImagesChangedEventArgs eventArgs)
// {
// foreach (var trackedImage in eventArgs.added)
// {
// AttachObjectToAnchor(trackedImage);
// }
//
// foreach (var trackedImage in eventArgs.updated)
// {
// AttachObjectToAnchor(trackedImage);
// }
// }
foreach (var trackedImage in eventArgs.added)
private void AttachObjectToAnchor(ARPlane plane)
{
AttachObjectToAnchor(trackedImage);
if (!planeManager.descriptor.supportsClassification) return;
if (plane.trackingState == TrackingState.None) return;
if (plane.classification != PlaneClassification.Floor) return;
if (!objectToPlace.gameObject.activeInHierarchy)
{
objectToPlace.gameObject.SetActive(true);
}
foreach (var trackedImage in eventArgs.updated)
{
if (trackedImage.trackingState == TrackingState.Limited || trackedImage.trackingState == TrackingState.None)
{
continue;
}
AttachObjectToAnchor(trackedImage);
}
}
private void AttachObjectToAnchor(ARTrackedImage trackedImage)
{
Vector3 imagePosition = trackedImage.transform.position;
List<ARRaycastHit> hits = new List<ARRaycastHit>();
if (raycastManager.Raycast(imagePosition, hits, TrackableType.PlaneWithinPolygon))
{
var hit = hits[0];
if (hit.trackable is ARPlane plane)
{
if (anchorManager.anchorPrefab == null)
{
objectToPlace.SetActive(true);
anchorManager.anchorPrefab = objectToPlace;
anchorManager.AttachAnchor(plane, hit.pose);
}
}
}
}
private void CheckForAnchor()
{
if (objectToPlace.GetComponent<ARAnchor>() == null)
{
objectToPlace.AddComponent<ARAnchor>();
}
objectToPlace.transform.position = plane.transform.position;
objectToPlace.transform.rotation = plane.transform.rotation;
}
private void ManagerCheck()
@ -79,18 +74,10 @@ namespace MAVRIC.GEEKCup
{
Log.Error("Failed to find ARTrackedImageManager...", this.gameObject);
}
if (raycastManager == null)
{
Log.Error("Failed to find ARRaycastManager...", this.gameObject);
}
if (planeManager == null)
{
Log.Error("Failed to find ARPlaneManager...", this.gameObject);
}
if (anchorManager == null)
{
Log.Error("Failed to find ARAnchorManager...", this.gameObject);
}
}
}
}

View File

@ -23,7 +23,10 @@ namespace MAVRIC.GEEKCup.Logging
var dataPath = Application.dataPath;
#if UNITY_EDITOR
dataPath = Path.Combine(dataPath, "..");
#elif UNITY_IOS
dataPath = Path.Combine(Application.persistentDataPath, "..");
#endif
var fullPath = Path.Join(dataPath, fileName);
Log.Logger = new Logger(new LoggerConfig()

View File

@ -144,8 +144,8 @@ MonoBehaviour:
zFailOperation: 0
m_ShadowTransparentReceive: 1
m_RenderingMode: 0
m_DepthPrimingMode: 0
m_CopyDepthMode: 0
m_DepthPrimingMode: 2
m_CopyDepthMode: 1
m_AccurateGbufferNormals: 0
m_IntermediateTextureMode: 1
--- !u!114 &3239328064754543239

View File

@ -4,7 +4,15 @@
"name": "NPM Registry",
"url": "https://registry.npmjs.org",
"scopes": [
"com.unity-atoms"
"com.unity-atoms",
"com.gilzoide"
]
},
{
"name": "package.openupm.com",
"url": "https://package.openupm.com",
"scopes": [
"com.gilzoide.safe-area-layout"
]
}
],

View File

@ -14,9 +14,12 @@ EditorBuildSettings:
- enabled: 0
path: Assets/Samples/MAVRIC.GEEKCup/QRCode/Scenes/QRCodeLoading.unity
guid: 73904ea13fff84c96a4386ddec7712f2
- enabled: 1
- enabled: 0
path: Assets/Samples/MAVRIC.GEEKCup/QRCode/Scenes/QRCodeLoading-Courses.unity
guid: 6530352416db24017ac352b24d187fbc
- enabled: 1
path: Assets/Scenes/LoadingAndAnchoring-Courses.unity
guid: abd4cb1ebafa649ceb66bfc0997721a8
m_configObjects:
UnityEditor.XR.ARCore.ARCoreSettings: {fileID: 11400000, guid: 6ee72d15cf39dd748a13eac57397b9af,
type: 2}

View File

@ -31,10 +31,19 @@ MonoBehaviour:
m_Url: https://registry.npmjs.org
m_Scopes:
- com.unity-atoms
- com.gilzoide
m_IsDefault: 0
m_Capabilities: 0
m_ConfigSource: 4
m_UserSelectedRegistryName: NPM Registry
- m_Id: scoped:project:package.openupm.com
m_Name: package.openupm.com
m_Url: https://package.openupm.com
m_Scopes:
- com.gilzoide.safe-area-layout
m_IsDefault: 0
m_Capabilities: 0
m_ConfigSource: 4
m_UserSelectedRegistryName: package.openupm.com
m_UserAddingNewScopedRegistry: 0
m_RegistryInfoDraft:
m_Modified: 0