From ab25af516ee03e10244a24a967bd154dcf7bb7ff Mon Sep 17 00:00:00 2001 From: hecomi Date: Sun, 20 Nov 2016 12:38:24 +0900 Subject: [PATCH] do not loop generation of monitors in creator. --- .../Examples/Scripts/GazePointAnalyzer.cs | 7 +++---- .../Examples/Scripts/MultipleMonitorCreator.cs | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Assets/uDesktopDuplication/Examples/Scripts/GazePointAnalyzer.cs b/Assets/uDesktopDuplication/Examples/Scripts/GazePointAnalyzer.cs index f9d490c..ce0f490 100644 --- a/Assets/uDesktopDuplication/Examples/Scripts/GazePointAnalyzer.cs +++ b/Assets/uDesktopDuplication/Examples/Scripts/GazePointAnalyzer.cs @@ -15,7 +15,6 @@ public class GazePointAnalyzer : MonoBehaviour { get { return GetWorldPositionFromCoord((int)averageCoord_.x, (int)averageCoord_.y); } } - private Vector2 preCursorCoord_ = Vector2.zero; [Header("Filters")] @@ -118,8 +117,6 @@ public class GazePointAnalyzer : MonoBehaviour filter = noEventFilter; } - preCursorCoord_ = cursorCoord; - var cf = (filter / ((1f / 60) / Time.deltaTime)); var vf = (velocityFilter / ((1f / 60) / Time.deltaTime)); var targetCoord = averageCoord_ + (coord - averageCoord_) * cf; @@ -127,11 +124,13 @@ public class GazePointAnalyzer : MonoBehaviour if (float.IsNaN(targetCoord.x) || float.IsNaN(targetCoord.y)) return; if (float.IsNaN(targetVelocity.x) || float.IsNaN(targetVelocity.y)) return; - + averageCoordVelocity_ += (targetVelocity - averageCoordVelocity_) * vf; averageCoord_ += averageCoordVelocity_; averageCoord_.x = Mathf.Clamp(averageCoord_.x, 0, monitor.width); averageCoord_.y = Mathf.Clamp(averageCoord_.y, 0, monitor.height); + + preCursorCoord_ = cursorCoord; } void Update() diff --git a/Assets/uDesktopDuplication/Examples/Scripts/MultipleMonitorCreator.cs b/Assets/uDesktopDuplication/Examples/Scripts/MultipleMonitorCreator.cs index 1a319fa..ecb5a5f 100644 --- a/Assets/uDesktopDuplication/Examples/Scripts/MultipleMonitorCreator.cs +++ b/Assets/uDesktopDuplication/Examples/Scripts/MultipleMonitorCreator.cs @@ -1,4 +1,5 @@ using UnityEngine; +using UnityEngine.Assertions; using System.Collections.Generic; using MeshForwardDirection = uDesktopDuplication.Texture.MeshForwardDirection; @@ -110,7 +111,7 @@ public class MultipleMonitorCreator : MonoBehaviour ResetRemoveTimer(); // Create monitors - for (int i = 0; i < uDesktopDuplication.Manager.monitorCount; ++i) { + for (int i = 0; i < uDesktopDuplication.Manager.monitors.Count; ++i) { // Create monitor obeject var go = Instantiate(monitorPrefab); go.name = "Monitor " + i;