From 0046202dce8a5615c59999c121caae1c1548beef Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Mon, 11 Nov 2024 23:49:47 +0100 Subject: [PATCH] Use follow solver and update canvas position --- Assets/Scenes/WebView.unity | 42 ++++++++++++++++++++++++++- Assets/Scripts/ConfigureOrbital.cs | 2 +- Assets/Scripts/EndpointLoader.cs | 6 ++-- Assets/Scripts/VideoCaptureHandler.cs | 2 ++ 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/Assets/Scenes/WebView.unity b/Assets/Scenes/WebView.unity index 736b019..f1d95b8 100644 --- a/Assets/Scenes/WebView.unity +++ b/Assets/Scenes/WebView.unity @@ -16977,6 +16977,7 @@ GameObject: - component: {fileID: 9095211984209372690} - component: {fileID: 9095211984209372689} - component: {fileID: 9095211984209372691} + - component: {fileID: 9095211984209372692} m_Layer: 0 m_Name: ScrollParent m_TagString: Untagged @@ -19695,7 +19696,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 3467693338133494675} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 4684083f6dff4a1d8a790bccc354fcf4, type: 3} m_Name: @@ -19927,6 +19928,45 @@ AudioSource: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 +--- !u!114 &9095211984209372692 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3467693338133494675} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4479a0bd44d822241a4c5f4890c481c0, type: 3} + m_Name: + m_EditorClassIdentifier: + updateLinkedTransform: 0 + moveLerpTime: 0.3 + rotateLerpTime: 0.1 + scaleLerpTime: 0 + maintainScaleOnInitialization: 1 + smoothing: 1 + lifetime: 0 + orientationType: 1 + faceTrackedObjectWhileClamped: 1 + faceUserDefinedTargetTransform: 0 + targetToFace: {fileID: 0} + pivotAxis: 7 + minDistance: 0.3 + maxDistance: 0.7 + defaultDistance: 0.5 + maxViewHorizontalDegrees: 30 + maxViewVerticalDegrees: 20 + reorientWhenOutsideParameters: 1 + orientToControllerDeadzoneDegrees: 60 + ignoreAngleClamp: 0 + ignoreDistanceClamp: 0 + ignoreReferencePitchAndRoll: 0 + pitchOffset: 0 + verticalMaxDistance: 0 + angularClampMode: 0 + tetherAngleSteps: 6 + boundsScaler: 1 --- !u!33 &9134068405370652459 MeshFilter: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/ConfigureOrbital.cs b/Assets/Scripts/ConfigureOrbital.cs index 6476f48..743ba8a 100644 --- a/Assets/Scripts/ConfigureOrbital.cs +++ b/Assets/Scripts/ConfigureOrbital.cs @@ -68,7 +68,7 @@ namespace WebViewStream { List canvases = endpointLoader.GetInstantiatedItems(); - Vector3 localOffset = new Vector3(-0.4f, 0.1f, 1f); + Vector3 localOffset = new Vector3(-0.3f, 0.1f, 1.5f); foreach (GameObject canvas in canvases) { diff --git a/Assets/Scripts/EndpointLoader.cs b/Assets/Scripts/EndpointLoader.cs index 99b785c..7442053 100644 --- a/Assets/Scripts/EndpointLoader.cs +++ b/Assets/Scripts/EndpointLoader.cs @@ -69,7 +69,7 @@ namespace WebViewStream private Vector3 CalculateNextPosition() { Transform cameraTransform = Camera.main.transform; - Vector3 localOffset = new Vector3(-0.4f, 0.1f, 1f); + Vector3 localOffset = new Vector3(-0.3f, 0.1f, 1.5f); if (instantiatedItems.Count == 0) { @@ -103,10 +103,10 @@ namespace WebViewStream RectTransform rectTransform = item.GetComponent(); if (rectTransform != null) { - return rectTransform.rect.width * rectTransform.lossyScale.x + 0.2f; + return rectTransform.rect.width * rectTransform.lossyScale.x; } - return 0.8f; + return 0.6f; } /// diff --git a/Assets/Scripts/VideoCaptureHandler.cs b/Assets/Scripts/VideoCaptureHandler.cs index b03d213..4339770 100644 --- a/Assets/Scripts/VideoCaptureHandler.cs +++ b/Assets/Scripts/VideoCaptureHandler.cs @@ -4,6 +4,8 @@ using Microsoft.MixedReality.Toolkit.UI; using UnityEngine; using UnityEngine.Windows.WebCam; #if WINDOWS_UWP && !UNITY_EDITOR +using System.Collections; +using System.Threading.Tasks; using Windows.Storage; #endif