Browse Source

Upload new CoinCreation version and another calculation for HMD

Julia Abels 2 years ago
parent
commit
26d1e02155
2 changed files with 22 additions and 6 deletions
  1. 9 3
      Assets/Coin/CoinCreation.cs
  2. 13 3
      Assets/Scripts/Controller/SensorBikeController.cs

+ 9 - 3
Assets/Coin/CoinCreation.cs

@@ -102,11 +102,17 @@ public class CoinCreation : MonoBehaviour
 
                 Vector3 rotationVector = new Vector3(0f, 0f, 0f);
 
-                if (start_point.slalom || (start_point.slalom && end_point.slalom))
+                // Zwischenlösung um Coins nicht in Kreuzungdatstellen zu müssen
+                int test = 1;
+                stepsize = stepsize - 1;
+
+                // if (start_point.slalom || (start_point.slalom && end_point.slalom))
+                if (start_point.slalom && end_point.slalom)
                 {
                     //TODO Was muss beim schiefen verteilen für den Slalom angepasst werden? z.B. stepsize?
                     Debug.Log("Coin-Creation: Place Coins for Slalom.");
-
+                    test = 0;
+                    stepsize = stepsize + 1;
                 }
                 if (distance_x > 0) // wenn entlang der x Richung verteilt wird
                 {
@@ -121,7 +127,7 @@ public class CoinCreation : MonoBehaviour
                     rotationVector = new Vector3(0f, 90f, 90f);
                 }
 
-                for (int i = 0; i < stepsize; ++i)
+                for (int i = test; i < stepsize; ++i)
                 {
                     //Coin-Position berechnen
                     if (start_point.x - end_point.x > 0)

+ 13 - 3
Assets/Scripts/Controller/SensorBikeController.cs

@@ -79,12 +79,22 @@ namespace Controller
                     Debug.Log("HMD Rotation " + player.transform.eulerAngles);
 
                     //Stand 02Juni Lab:
-                    //var rot = player.transform.rotation;
-                    //var yaw = Mathf.Asin(2 * rot.x * rot.y + 2 * rot.z * rot.w);
-                    
+                    var rot = player.transform.rotation;
+                    var yaw = Mathf.Asin(2 * rot.x * rot.y + 2 * rot.z * rot.w);
+
                     //Lisa: 
                     //var rot = player.transform.localRotation.eulerAngles.y; // https://answers.unity.com/questions/149801/transformrotation-in-degrees-instead-of-0-to-1.html
                     //var yaw = rot *3f; // da kopfdrehung relativ gering im vergleich zu einer lenkraddrehung, faktor ggf. erhöhen
+
+                    //Julia:
+                    // https://wirewhiz.com/vr-body-tracking-tutorial-pt-1/
+                    // Bestimme Winkel zwischen Kopf und Fahrrad
+                    //var rot_player = player.transform.rotation;
+                    //var rot_bike = GameObject.FindGameObjectWithTag("bike").transform.rotation;
+                    //var yaw = Quaternion.Angle(Quaternion.Euler(0, rot_bike.eulerAngles.y, 0),
+                    //    Quaternion.Euler(0, rot_player.eulerAngles.y, 0));
+
+
                     bicycleController.CurrentSteerAngle = yaw;
                     break;
             }