From 4919238bbb4e93ede23e836052b43e943ebb5e12 Mon Sep 17 00:00:00 2001 From: benoitgeslain Date: Wed, 26 Jun 2024 14:59:43 +0200 Subject: [PATCH] fixed APF Messinger --- .../{APF Volumes.unity => APF Messinger.unity} | 0 ...F Volumes.unity.meta => APF Messinger.unity.meta} | 0 .../Scripts/Utils/PhysicalEnvironmentCalibration.cs | 12 ++++++++---- 3 files changed, 8 insertions(+), 4 deletions(-) rename Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Sample Scenes/{APF Volumes.unity => APF Messinger.unity} (100%) rename Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Sample Scenes/{APF Volumes.unity.meta => APF Messinger.unity.meta} (100%) diff --git a/Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Sample Scenes/APF Volumes.unity b/Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Sample Scenes/APF Messinger.unity similarity index 100% rename from Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Sample Scenes/APF Volumes.unity rename to Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Sample Scenes/APF Messinger.unity diff --git a/Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Sample Scenes/APF Volumes.unity.meta b/Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Sample Scenes/APF Messinger.unity.meta similarity index 100% rename from Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Sample Scenes/APF Volumes.unity.meta rename to Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Sample Scenes/APF Messinger.unity.meta diff --git a/Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Scripts/Utils/PhysicalEnvironmentCalibration.cs b/Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Scripts/Utils/PhysicalEnvironmentCalibration.cs index 36fdf704..441ddca6 100644 --- a/Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Scripts/Utils/PhysicalEnvironmentCalibration.cs +++ b/Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Scripts/Utils/PhysicalEnvironmentCalibration.cs @@ -10,6 +10,8 @@ public class PhysicalEnvironmentCalibration : MonoBehaviour { [SerializeField] private Transform user; [SerializeField] private List bounds; + List obs, obs2; + // Start is called before the first frame update void Start() { @@ -17,16 +19,18 @@ void Start() { // Update is called once per frame void Update() { - var obs = bounds.CyclicPairs().SelectMany( + Random.InitState(1); + obs = bounds.CyclicPairs().SelectMany( p => { var dir = (p.Item1 - p.Item2).normalized; var n = (int)(Vector3.Distance(p.Item1, p.Item2) / eps); - return Enumerable.Range(0, n).Select(j => p.Item1 + (j + 0.5f) * eps * dir); + + return Enumerable.Range(0, n).Select(j => p.Item2 + (j + 0.5f) * eps * dir); } ).ToList(); - Debug.Log(obs.Count); - obs.ForEach(o => Debug.Log(o)); + // Debug.Log(obs.Count); + // obs.ForEach(o => Debug.Log(o)); Debug.DrawRay(user.position, ComputeGradient(user, obs).normalized); }