Browse Source

GamepadBikeController and BicycleController improvements

Marcel Zickler 3 years ago
parent
commit
3477155012
34 changed files with 1817 additions and 29 deletions
  1. 1 0
      .idea/.idea.VR Cycling/.idea/indexLayout.xml
  2. 1 9
      .idea/.idea.VR Cycling/riderModule.iml
  3. 0 0
      Assembly-CSharp-Editor.csproj
  4. 0 0
      Assembly-CSharp.csproj
  5. 68 0
      Assets/GamepadBikeController.cs
  6. 11 0
      Assets/GamepadBikeController.cs.meta
  7. 8 0
      Assets/InputActions.meta
  8. 277 0
      Assets/InputActions/InputMaster.cs
  9. 11 0
      Assets/InputActions/InputMaster.cs.meta
  10. 149 0
      Assets/InputActions/InputMaster.inputactions
  11. 14 0
      Assets/InputActions/InputMaster.inputactions.meta
  12. BIN
      Assets/Models/uploads_files_2010290_LowPoly.fbx
  13. 97 0
      Assets/Models/uploads_files_2010290_LowPoly.fbx.meta
  14. BIN
      Assets/Models/uploads_files_2449612_low_Poly_Berg2.fbx
  15. 97 0
      Assets/Models/uploads_files_2449612_low_Poly_Berg2.fbx.meta
  16. 30 0
      Assets/OverrideLeaningController.cs
  17. 11 0
      Assets/OverrideLeaningController.cs.meta
  18. 87 0
      Assets/RbMovement.cs
  19. 11 0
      Assets/RbMovement.cs.meta
  20. 20 0
      Assets/RollingSphere.cs
  21. 11 0
      Assets/RollingSphere.cs.meta
  22. 887 9
      Assets/Scenes/MainScene.unity
  23. 3 0
      Assets/Scripts/BicyleController/BicycleController.cs
  24. 12 8
      Assets/Scripts/BicyleController/WheelConfig.cs
  25. 1 0
      Packages/manifest.json
  26. 7 0
      Packages/packages-lock.json
  27. 2 2
      ProjectSettings/ProjectSettings.asset
  28. 1 1
      ProjectSettings/QualitySettings.asset
  29. 0 0
      SteamVR.csproj
  30. 0 0
      SteamVR_Editor.csproj
  31. 0 0
      SteamVR_Input_Editor.csproj
  32. 0 0
      SteamVR_Windows_EditorHelper.csproj
  33. BIN
      obj/Debug/Assembly-CSharp.csprojAssemblyReference.cache
  34. BIN
      obj/Debug/SteamVR_Windows_EditorHelper.csprojAssemblyReference.cache

+ 1 - 0
.idea/.idea.VR Cycling/.idea/indexLayout.xml

@@ -11,6 +11,7 @@
       <Path>Library/PackageCache/com.unity.formats.fbx@3.2.1-preview.2</Path>
       <Path>Library/PackageCache/com.unity.ide.rider@1.1.4</Path>
       <Path>Library/PackageCache/com.unity.ide.vscode@1.2.3</Path>
+      <Path>Library/PackageCache/com.unity.inputsystem@1.0.1</Path>
       <Path>Library/PackageCache/com.unity.recorder@2.2.0-preview.4</Path>
       <Path>Library/PackageCache/com.unity.render-pipelines.core@7.3.1</Path>
       <Path>Library/PackageCache/com.unity.render-pipelines.universal@7.3.1</Path>

+ 1 - 9
.idea/.idea.VR Cycling/riderModule.iml

@@ -1,15 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <module type="RIDER_MODULE" version="4">
   <component name="NewModuleRootManager">
-    <content url="file://$MODULE_DIR$/../..">
-      <excludeFolder url="file://$MODULE_DIR$/../../External/BikePowerRecordingLibrary/.vs" />
-      <excludeFolder url="file://$MODULE_DIR$/../../External/Models" />
-      <excludeFolder url="file://$MODULE_DIR$/../../External/Printing" />
-      <excludeFolder url="file://$MODULE_DIR$/../../External/antplus_simulator_src/.vs" />
-      <excludeFolder url="file://$MODULE_DIR$/../../External/antplus_simulator_src/Backup" />
-      <excludeFolder url="file://$MODULE_DIR$/../../Library" />
-      <excludeFolder url="file://$MODULE_DIR$/../../Temp" />
-    </content>
+    <content url="file://$MODULE_DIR$/../.." />
     <content url="file://$USER_HOME$/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.test-framework@1.1.18" />
     <orderEntry type="sourceFolder" forTests="false" />
   </component>

File diff suppressed because it is too large
+ 0 - 0
Assembly-CSharp-Editor.csproj


File diff suppressed because it is too large
+ 0 - 0
Assembly-CSharp.csproj


+ 68 - 0
Assets/GamepadBikeController.cs

@@ -0,0 +1,68 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using JetBrains.Annotations;
+using UnityEngine;
+using UnityEngine.InputSystem;
+
+[RequireComponent(typeof(PlayerInput))]
+[RequireComponent(typeof(BicycleController))]
+public class GamepadBikeController : MonoBehaviour
+{
+    public bool useSpeed;
+    public bool useSteer;
+    public bool useLean;
+
+    public float speedMultiplier = 200f;
+    public float leanMultiplier = 20f;
+    public float steerMultiplier = 15f;
+
+    private float speed;
+    private float lean;
+    private float steer;
+    private BicycleController bicycleController;
+        
+    private void Start()
+    {
+        bicycleController = GetComponent<BicycleController>();
+    }
+    
+    private void Update()
+    {
+        if(useSteer) bicycleController.CurrentSteerAngle = steer;
+        if(useLean) bicycleController.CurrentLeaningAngle = lean;
+        if (useSpeed)
+        {
+            if (speed < 0)
+            {
+                bicycleController.CurrentMotorTorque = 0;
+                bicycleController.CurrentBrakeTorque = -speed;
+            }
+            else
+            {
+                bicycleController.CurrentBrakeTorque = 0;
+                bicycleController.CurrentMotorTorque = speed;
+            }
+        }
+    }
+    
+    [UsedImplicitly]
+    public void OnSpeed(InputValue value)
+    {
+        speed = value.Get<float>() * speedMultiplier;
+    }
+    
+    [UsedImplicitly]
+    public void OnLean(InputValue value)
+    {
+        lean = value.Get<float>() * leanMultiplier;
+    }
+    
+    [UsedImplicitly]
+    public void OnSteer(InputValue value)
+    {
+        steer = value.Get<float>() * steerMultiplier;
+    }
+
+
+}

+ 11 - 0
Assets/GamepadBikeController.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 1c898ad362c5f694b9f10256b4bdb616
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Assets/InputActions.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: f1fe5b8d6ba4a8a4980a6bfbdecf5c6c
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 277 - 0
Assets/InputActions/InputMaster.cs

@@ -0,0 +1,277 @@
+// GENERATED AUTOMATICALLY FROM 'Assets/InputActions/InputMaster.inputactions'
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine.InputSystem;
+using UnityEngine.InputSystem.Utilities;
+
+public class @InputMaster : IInputActionCollection, IDisposable
+{
+    public InputActionAsset asset { get; }
+    public @InputMaster()
+    {
+        asset = InputActionAsset.FromJson(@"{
+    ""name"": ""InputMaster"",
+    ""maps"": [
+        {
+            ""name"": ""Player"",
+            ""id"": ""c0e731dc-cca5-4e31-9e39-322320614628"",
+            ""actions"": [
+                {
+                    ""name"": ""Steer"",
+                    ""type"": ""Value"",
+                    ""id"": ""0c2e0063-2a71-41fa-8558-c860d648d00a"",
+                    ""expectedControlType"": ""Analog"",
+                    ""processors"": """",
+                    ""interactions"": """"
+                },
+                {
+                    ""name"": ""Lean"",
+                    ""type"": ""Value"",
+                    ""id"": ""11b8defd-5887-45af-b2e8-f3442e007bcf"",
+                    ""expectedControlType"": ""Analog"",
+                    ""processors"": """",
+                    ""interactions"": """"
+                },
+                {
+                    ""name"": ""Speed"",
+                    ""type"": ""Value"",
+                    ""id"": ""0368d4e7-2254-4f77-a048-c03d5a9e9466"",
+                    ""expectedControlType"": ""Analog"",
+                    ""processors"": """",
+                    ""interactions"": """"
+                }
+            ],
+            ""bindings"": [
+                {
+                    ""name"": ""1D Axis"",
+                    ""id"": ""809e58c9-063d-4091-85dd-c6912da7887c"",
+                    ""path"": ""1DAxis(minValue=-20,maxValue=20)"",
+                    ""interactions"": """",
+                    ""processors"": """",
+                    ""groups"": """",
+                    ""action"": ""Steer"",
+                    ""isComposite"": true,
+                    ""isPartOfComposite"": false
+                },
+                {
+                    ""name"": ""negative"",
+                    ""id"": ""918a761d-d749-4fab-943b-b15b684ff46b"",
+                    ""path"": ""<Gamepad>/leftStick/left"",
+                    ""interactions"": """",
+                    ""processors"": """",
+                    ""groups"": ""Xbox Control Scheme"",
+                    ""action"": ""Steer"",
+                    ""isComposite"": false,
+                    ""isPartOfComposite"": true
+                },
+                {
+                    ""name"": ""positive"",
+                    ""id"": ""d09cba85-d987-46fc-89c7-98a9410da5ea"",
+                    ""path"": ""<Gamepad>/leftStick/right"",
+                    ""interactions"": """",
+                    ""processors"": """",
+                    ""groups"": ""Xbox Control Scheme"",
+                    ""action"": ""Steer"",
+                    ""isComposite"": false,
+                    ""isPartOfComposite"": true
+                },
+                {
+                    ""name"": ""1D Axis"",
+                    ""id"": ""ca704029-9a84-41e8-9def-5edf0439737a"",
+                    ""path"": ""1DAxis(minValue=-20,maxValue=20)"",
+                    ""interactions"": """",
+                    ""processors"": """",
+                    ""groups"": """",
+                    ""action"": ""Lean"",
+                    ""isComposite"": true,
+                    ""isPartOfComposite"": false
+                },
+                {
+                    ""name"": ""negative"",
+                    ""id"": ""02ebe08c-4529-44b9-9d52-47c3454c09ed"",
+                    ""path"": ""<Gamepad>/rightStick/left"",
+                    ""interactions"": """",
+                    ""processors"": """",
+                    ""groups"": ""Xbox Control Scheme"",
+                    ""action"": ""Lean"",
+                    ""isComposite"": false,
+                    ""isPartOfComposite"": true
+                },
+                {
+                    ""name"": ""positive"",
+                    ""id"": ""afcc1116-c915-451a-9058-b47acbc00d4d"",
+                    ""path"": ""<Gamepad>/rightStick/right"",
+                    ""interactions"": """",
+                    ""processors"": """",
+                    ""groups"": ""Xbox Control Scheme"",
+                    ""action"": ""Lean"",
+                    ""isComposite"": false,
+                    ""isPartOfComposite"": true
+                },
+                {
+                    ""name"": ""1D Axis"",
+                    ""id"": ""ef5544f0-948e-4ac2-9b5a-740ab381b571"",
+                    ""path"": ""1DAxis(minValue=-300,maxValue=300)"",
+                    ""interactions"": """",
+                    ""processors"": """",
+                    ""groups"": """",
+                    ""action"": ""Speed"",
+                    ""isComposite"": true,
+                    ""isPartOfComposite"": false
+                },
+                {
+                    ""name"": ""negative"",
+                    ""id"": ""190c1e38-5a07-4cf2-ac16-b1d89d70a921"",
+                    ""path"": ""<Gamepad>/leftTrigger"",
+                    ""interactions"": """",
+                    ""processors"": """",
+                    ""groups"": ""Xbox Control Scheme"",
+                    ""action"": ""Speed"",
+                    ""isComposite"": false,
+                    ""isPartOfComposite"": true
+                },
+                {
+                    ""name"": ""positive"",
+                    ""id"": ""aa7db5f0-9d6e-44b0-bdd2-fad109320909"",
+                    ""path"": ""<Gamepad>/rightTrigger"",
+                    ""interactions"": """",
+                    ""processors"": """",
+                    ""groups"": ""Xbox Control Scheme"",
+                    ""action"": ""Speed"",
+                    ""isComposite"": false,
+                    ""isPartOfComposite"": true
+                }
+            ]
+        }
+    ],
+    ""controlSchemes"": [
+        {
+            ""name"": ""Xbox Control Scheme"",
+            ""bindingGroup"": ""Xbox Control Scheme"",
+            ""devices"": [
+                {
+                    ""devicePath"": ""<XInputController>"",
+                    ""isOptional"": false,
+                    ""isOR"": false
+                }
+            ]
+        }
+    ]
+}");
+        // Player
+        m_Player = asset.FindActionMap("Player", throwIfNotFound: true);
+        m_Player_Steer = m_Player.FindAction("Steer", throwIfNotFound: true);
+        m_Player_Lean = m_Player.FindAction("Lean", throwIfNotFound: true);
+        m_Player_Speed = m_Player.FindAction("Speed", throwIfNotFound: true);
+    }
+
+    public void Dispose()
+    {
+        UnityEngine.Object.Destroy(asset);
+    }
+
+    public InputBinding? bindingMask
+    {
+        get => asset.bindingMask;
+        set => asset.bindingMask = value;
+    }
+
+    public ReadOnlyArray<InputDevice>? devices
+    {
+        get => asset.devices;
+        set => asset.devices = value;
+    }
+
+    public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
+
+    public bool Contains(InputAction action)
+    {
+        return asset.Contains(action);
+    }
+
+    public IEnumerator<InputAction> GetEnumerator()
+    {
+        return asset.GetEnumerator();
+    }
+
+    IEnumerator IEnumerable.GetEnumerator()
+    {
+        return GetEnumerator();
+    }
+
+    public void Enable()
+    {
+        asset.Enable();
+    }
+
+    public void Disable()
+    {
+        asset.Disable();
+    }
+
+    // Player
+    private readonly InputActionMap m_Player;
+    private IPlayerActions m_PlayerActionsCallbackInterface;
+    private readonly InputAction m_Player_Steer;
+    private readonly InputAction m_Player_Lean;
+    private readonly InputAction m_Player_Speed;
+    public struct PlayerActions
+    {
+        private @InputMaster m_Wrapper;
+        public PlayerActions(@InputMaster wrapper) { m_Wrapper = wrapper; }
+        public InputAction @Steer => m_Wrapper.m_Player_Steer;
+        public InputAction @Lean => m_Wrapper.m_Player_Lean;
+        public InputAction @Speed => m_Wrapper.m_Player_Speed;
+        public InputActionMap Get() { return m_Wrapper.m_Player; }
+        public void Enable() { Get().Enable(); }
+        public void Disable() { Get().Disable(); }
+        public bool enabled => Get().enabled;
+        public static implicit operator InputActionMap(PlayerActions set) { return set.Get(); }
+        public void SetCallbacks(IPlayerActions instance)
+        {
+            if (m_Wrapper.m_PlayerActionsCallbackInterface != null)
+            {
+                @Steer.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnSteer;
+                @Steer.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnSteer;
+                @Steer.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnSteer;
+                @Lean.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLean;
+                @Lean.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLean;
+                @Lean.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLean;
+                @Speed.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnSpeed;
+                @Speed.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnSpeed;
+                @Speed.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnSpeed;
+            }
+            m_Wrapper.m_PlayerActionsCallbackInterface = instance;
+            if (instance != null)
+            {
+                @Steer.started += instance.OnSteer;
+                @Steer.performed += instance.OnSteer;
+                @Steer.canceled += instance.OnSteer;
+                @Lean.started += instance.OnLean;
+                @Lean.performed += instance.OnLean;
+                @Lean.canceled += instance.OnLean;
+                @Speed.started += instance.OnSpeed;
+                @Speed.performed += instance.OnSpeed;
+                @Speed.canceled += instance.OnSpeed;
+            }
+        }
+    }
+    public PlayerActions @Player => new PlayerActions(this);
+    private int m_XboxControlSchemeSchemeIndex = -1;
+    public InputControlScheme XboxControlSchemeScheme
+    {
+        get
+        {
+            if (m_XboxControlSchemeSchemeIndex == -1) m_XboxControlSchemeSchemeIndex = asset.FindControlSchemeIndex("Xbox Control Scheme");
+            return asset.controlSchemes[m_XboxControlSchemeSchemeIndex];
+        }
+    }
+    public interface IPlayerActions
+    {
+        void OnSteer(InputAction.CallbackContext context);
+        void OnLean(InputAction.CallbackContext context);
+        void OnSpeed(InputAction.CallbackContext context);
+    }
+}

+ 11 - 0
Assets/InputActions/InputMaster.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: e4ea1f3f2f10ce744b42fb26e5379de8
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 149 - 0
Assets/InputActions/InputMaster.inputactions

@@ -0,0 +1,149 @@
+{
+    "name": "InputMaster",
+    "maps": [
+        {
+            "name": "Player",
+            "id": "c0e731dc-cca5-4e31-9e39-322320614628",
+            "actions": [
+                {
+                    "name": "Steer",
+                    "type": "Value",
+                    "id": "0c2e0063-2a71-41fa-8558-c860d648d00a",
+                    "expectedControlType": "Analog",
+                    "processors": "",
+                    "interactions": ""
+                },
+                {
+                    "name": "Lean",
+                    "type": "Value",
+                    "id": "11b8defd-5887-45af-b2e8-f3442e007bcf",
+                    "expectedControlType": "Analog",
+                    "processors": "",
+                    "interactions": ""
+                },
+                {
+                    "name": "Speed",
+                    "type": "Value",
+                    "id": "0368d4e7-2254-4f77-a048-c03d5a9e9466",
+                    "expectedControlType": "Analog",
+                    "processors": "",
+                    "interactions": ""
+                }
+            ],
+            "bindings": [
+                {
+                    "name": "1D Axis",
+                    "id": "809e58c9-063d-4091-85dd-c6912da7887c",
+                    "path": "1DAxis(minValue=-20,maxValue=20)",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Steer",
+                    "isComposite": true,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "negative",
+                    "id": "918a761d-d749-4fab-943b-b15b684ff46b",
+                    "path": "<Gamepad>/leftStick/left",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "Xbox Control Scheme",
+                    "action": "Steer",
+                    "isComposite": false,
+                    "isPartOfComposite": true
+                },
+                {
+                    "name": "positive",
+                    "id": "d09cba85-d987-46fc-89c7-98a9410da5ea",
+                    "path": "<Gamepad>/leftStick/right",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "Xbox Control Scheme",
+                    "action": "Steer",
+                    "isComposite": false,
+                    "isPartOfComposite": true
+                },
+                {
+                    "name": "1D Axis",
+                    "id": "ca704029-9a84-41e8-9def-5edf0439737a",
+                    "path": "1DAxis(minValue=-20,maxValue=20)",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Lean",
+                    "isComposite": true,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "negative",
+                    "id": "02ebe08c-4529-44b9-9d52-47c3454c09ed",
+                    "path": "<Gamepad>/rightStick/left",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "Xbox Control Scheme",
+                    "action": "Lean",
+                    "isComposite": false,
+                    "isPartOfComposite": true
+                },
+                {
+                    "name": "positive",
+                    "id": "afcc1116-c915-451a-9058-b47acbc00d4d",
+                    "path": "<Gamepad>/rightStick/right",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "Xbox Control Scheme",
+                    "action": "Lean",
+                    "isComposite": false,
+                    "isPartOfComposite": true
+                },
+                {
+                    "name": "1D Axis",
+                    "id": "ef5544f0-948e-4ac2-9b5a-740ab381b571",
+                    "path": "1DAxis(minValue=-300,maxValue=300)",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Speed",
+                    "isComposite": true,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "negative",
+                    "id": "190c1e38-5a07-4cf2-ac16-b1d89d70a921",
+                    "path": "<Gamepad>/leftTrigger",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "Xbox Control Scheme",
+                    "action": "Speed",
+                    "isComposite": false,
+                    "isPartOfComposite": true
+                },
+                {
+                    "name": "positive",
+                    "id": "aa7db5f0-9d6e-44b0-bdd2-fad109320909",
+                    "path": "<Gamepad>/rightTrigger",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "Xbox Control Scheme",
+                    "action": "Speed",
+                    "isComposite": false,
+                    "isPartOfComposite": true
+                }
+            ]
+        }
+    ],
+    "controlSchemes": [
+        {
+            "name": "Xbox Control Scheme",
+            "bindingGroup": "Xbox Control Scheme",
+            "devices": [
+                {
+                    "devicePath": "<XInputController>",
+                    "isOptional": false,
+                    "isOR": false
+                }
+            ]
+        }
+    ]
+}

+ 14 - 0
Assets/InputActions/InputMaster.inputactions.meta

@@ -0,0 +1,14 @@
+fileFormatVersion: 2
+guid: 5f226970d372e2149ae0e45f97171799
+ScriptedImporter:
+  internalIDToNameTable: []
+  externalObjects: {}
+  serializedVersion: 2
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
+  script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
+  generateWrapperCode: 1
+  wrapperCodePath: 
+  wrapperClassName: 
+  wrapperCodeNamespace: 

BIN
Assets/Models/uploads_files_2010290_LowPoly.fbx


+ 97 - 0
Assets/Models/uploads_files_2010290_LowPoly.fbx.meta

@@ -0,0 +1,97 @@
+fileFormatVersion: 2
+guid: fc131f68191170646976d664f0ac1cbc
+ModelImporter:
+  serializedVersion: 19301
+  internalIDToNameTable: []
+  externalObjects: {}
+  materials:
+    materialImportMode: 1
+    materialName: 0
+    materialSearch: 1
+    materialLocation: 1
+  animations:
+    legacyGenerateAnimations: 4
+    bakeSimulation: 0
+    resampleCurves: 1
+    optimizeGameObjects: 0
+    motionNodeName: 
+    rigImportErrors: 
+    rigImportWarnings: 
+    animationImportErrors: 
+    animationImportWarnings: 
+    animationRetargetingWarnings: 
+    animationDoRetargetingWarnings: 0
+    importAnimatedCustomProperties: 0
+    importConstraints: 0
+    animationCompression: 1
+    animationRotationError: 0.5
+    animationPositionError: 0.5
+    animationScaleError: 0.5
+    animationWrapMode: 0
+    extraExposedTransformPaths: []
+    extraUserProperties: []
+    clipAnimations: []
+    isReadable: 0
+  meshes:
+    lODScreenPercentages: []
+    globalScale: 1
+    meshCompression: 0
+    addColliders: 0
+    useSRGBMaterialColor: 1
+    sortHierarchyByName: 1
+    importVisibility: 1
+    importBlendShapes: 1
+    importCameras: 1
+    importLights: 1
+    fileIdsGeneration: 2
+    swapUVChannels: 0
+    generateSecondaryUV: 0
+    useFileUnits: 1
+    keepQuads: 0
+    weldVertices: 1
+    preserveHierarchy: 0
+    skinWeightsMode: 0
+    maxBonesPerVertex: 4
+    minBoneWeight: 0.001
+    meshOptimizationFlags: -1
+    indexFormat: 0
+    secondaryUVAngleDistortion: 8
+    secondaryUVAreaDistortion: 15.000001
+    secondaryUVHardAngle: 88
+    secondaryUVPackMargin: 4
+    useFileScale: 1
+  tangentSpace:
+    normalSmoothAngle: 60
+    normalImportMode: 0
+    tangentImportMode: 3
+    normalCalculationMode: 4
+    legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
+    blendShapeNormalImportMode: 1
+    normalSmoothingSource: 0
+  referencedClips: []
+  importAnimation: 1
+  humanDescription:
+    serializedVersion: 3
+    human: []
+    skeleton: []
+    armTwist: 0.5
+    foreArmTwist: 0.5
+    upperLegTwist: 0.5
+    legTwist: 0.5
+    armStretch: 0.05
+    legStretch: 0.05
+    feetSpacing: 0
+    globalScale: 1
+    rootMotionBoneName: 
+    hasTranslationDoF: 0
+    hasExtraRoot: 0
+    skeletonHasParents: 1
+  lastHumanDescriptionAvatarSource: {instanceID: 0}
+  autoGenerateAvatarMappingIfUnspecified: 1
+  animationType: 2
+  humanoidOversampling: 1
+  avatarSetup: 0
+  additionalBone: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/Models/uploads_files_2449612_low_Poly_Berg2.fbx


+ 97 - 0
Assets/Models/uploads_files_2449612_low_Poly_Berg2.fbx.meta

@@ -0,0 +1,97 @@
+fileFormatVersion: 2
+guid: 5ad3eb6337b0311448a3e293d26194be
+ModelImporter:
+  serializedVersion: 19301
+  internalIDToNameTable: []
+  externalObjects: {}
+  materials:
+    materialImportMode: 1
+    materialName: 0
+    materialSearch: 1
+    materialLocation: 1
+  animations:
+    legacyGenerateAnimations: 4
+    bakeSimulation: 0
+    resampleCurves: 1
+    optimizeGameObjects: 0
+    motionNodeName: 
+    rigImportErrors: 
+    rigImportWarnings: 
+    animationImportErrors: 
+    animationImportWarnings: 
+    animationRetargetingWarnings: 
+    animationDoRetargetingWarnings: 0
+    importAnimatedCustomProperties: 0
+    importConstraints: 0
+    animationCompression: 1
+    animationRotationError: 0.5
+    animationPositionError: 0.5
+    animationScaleError: 0.5
+    animationWrapMode: 0
+    extraExposedTransformPaths: []
+    extraUserProperties: []
+    clipAnimations: []
+    isReadable: 0
+  meshes:
+    lODScreenPercentages: []
+    globalScale: 1
+    meshCompression: 0
+    addColliders: 0
+    useSRGBMaterialColor: 1
+    sortHierarchyByName: 1
+    importVisibility: 1
+    importBlendShapes: 1
+    importCameras: 1
+    importLights: 1
+    fileIdsGeneration: 2
+    swapUVChannels: 0
+    generateSecondaryUV: 0
+    useFileUnits: 1
+    keepQuads: 0
+    weldVertices: 1
+    preserveHierarchy: 0
+    skinWeightsMode: 0
+    maxBonesPerVertex: 4
+    minBoneWeight: 0.001
+    meshOptimizationFlags: -1
+    indexFormat: 0
+    secondaryUVAngleDistortion: 8
+    secondaryUVAreaDistortion: 15.000001
+    secondaryUVHardAngle: 88
+    secondaryUVPackMargin: 4
+    useFileScale: 1
+  tangentSpace:
+    normalSmoothAngle: 60
+    normalImportMode: 0
+    tangentImportMode: 3
+    normalCalculationMode: 4
+    legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
+    blendShapeNormalImportMode: 1
+    normalSmoothingSource: 0
+  referencedClips: []
+  importAnimation: 1
+  humanDescription:
+    serializedVersion: 3
+    human: []
+    skeleton: []
+    armTwist: 0.5
+    foreArmTwist: 0.5
+    upperLegTwist: 0.5
+    legTwist: 0.5
+    armStretch: 0.05
+    legStretch: 0.05
+    feetSpacing: 0
+    globalScale: 1
+    rootMotionBoneName: 
+    hasTranslationDoF: 0
+    hasExtraRoot: 0
+    skeletonHasParents: 1
+  lastHumanDescriptionAvatarSource: {instanceID: 0}
+  autoGenerateAvatarMappingIfUnspecified: 1
+  animationType: 2
+  humanoidOversampling: 1
+  avatarSetup: 0
+  additionalBone: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 30 - 0
Assets/OverrideLeaningController.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class OverrideLeaningController : MonoBehaviour
+{
+    private BicycleController bicycleController;
+    private Rigidbody rigidbody;
+
+    // Start is called before the first frame update
+    void Start()
+    {
+        bicycleController = GetComponent<BicycleController>();
+        rigidbody = GetComponentInChildren<Rigidbody>();
+
+        bicycleController.offsetCollidersFromWheel = 2f;
+    }
+
+    // Update is called once per frame
+    void Update()
+    {
+        //rigidbody.rotation = Quaternion.AngleAxis(bicycleController.CurrentLeaningAngle, rigidbody.transform.forward);
+    }
+
+    private void FixedUpdate()
+    {
+        //rigidbody.MoveRotation(Quaternion.AngleAxis(bicycleController.CurrentLeaningAngle, rigidbody.transform.forward));
+    }
+}

+ 11 - 0
Assets/OverrideLeaningController.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f859d490f3e63ce44a8ce1f2ce7a885b
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 87 - 0
Assets/RbMovement.cs

@@ -0,0 +1,87 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class RbMovement : MonoBehaviour
+{
+    private Transform t;
+    public Transform bottom;
+
+    private Rigidbody rb;
+    // Start is called before the first frame update
+
+    private float speedIncreasePerSecond = 2f;
+    private float leanIncreasePerSecond = 10f;
+    private float steerIncreasePerSecond = 15f;
+
+    private float speed;
+    private float lean;
+    private float steer;
+
+    void Start()
+    {
+        rb = GetComponent<Rigidbody>();
+        t = transform;
+    }
+
+    private void Update()
+    {
+        if (Input.GetKey(KeyCode.W))
+        {
+            speed += speedIncreasePerSecond * Time.deltaTime;
+        }
+        else if (Input.GetKeyUp(KeyCode.W))
+        {
+            speed = 0;
+        }
+
+        if (Input.GetKey(KeyCode.S))
+        {
+            speed -= speedIncreasePerSecond * Time.deltaTime;
+        }
+        else if (Input.GetKeyUp(KeyCode.S))
+        {
+            speed = 0;
+        }
+
+
+        if (Input.GetKey(KeyCode.A))
+        {
+            steer += steerIncreasePerSecond * Time.deltaTime;
+        }
+
+        if (Input.GetKey(KeyCode.D))
+        {
+            steer -= steerIncreasePerSecond * Time.deltaTime;
+        }
+
+        if (Input.GetKeyUp(KeyCode.A) || Input.GetKeyUp(KeyCode.D))
+        {
+            steer = 0;
+        }
+
+        if (Input.GetKey(KeyCode.Q))
+        {
+            lean -= leanIncreasePerSecond * Time.deltaTime;
+        }
+
+        if (Input.GetKey(KeyCode.E))
+        {
+            lean += leanIncreasePerSecond * Time.deltaTime;
+        }
+
+        if (Input.GetKeyUp(KeyCode.Q) || Input.GetKeyUp(KeyCode.E))
+        {
+            lean = 0f;
+        }
+    }
+
+    // Update is called once per frame
+    void FixedUpdate()
+    {
+        t.RotateAround(t.position, t.up, steer);
+        t.RotateAround(bottom.position, t.forward, lean);
+        rb.MovePosition(rb.position + t.forward * (Time.deltaTime * speed));
+    }
+}

+ 11 - 0
Assets/RbMovement.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 44afa483c1b39384ba8eb17306e6f872
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 20 - 0
Assets/RollingSphere.cs

@@ -0,0 +1,20 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class RollingSphere : MonoBehaviour
+{
+    private Rigidbody sphere;
+    // Start is called before the first frame update
+    void Start()
+    {
+        sphere = GetComponent<Rigidbody>();
+    }
+
+    // Update is called once per frame
+    void Update()
+    {
+        sphere.AddTorque(0,0,1);
+        
+    }
+}

+ 11 - 0
Assets/RollingSphere.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: cc00e1f5b2b73a64ab23f0794cfef5d6
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

File diff suppressed because it is too large
+ 887 - 9
Assets/Scenes/MainScene.unity


+ 3 - 0
Assets/Scripts/BicyleController/BicycleController.cs

@@ -76,6 +76,8 @@ public class BicycleController : MonoBehaviour
 
     private void ApplyColliderForces()
     {
+        //offsetCollidersFromWheel = Mathf.Max(0.05f, 0.45f - rigidBody.velocity.magnitude * 0.07f);
+        //wheelConfig.AdjustToGameObjects(frontWheel.transform, rearWheel.transform, offsetCollidersFromWheel);
         ControlSteer(new[] {wheelConfig.frontLeft, wheelConfig.frontRight});
         ControlTorque(new[] {wheelConfig.rearLeft, wheelConfig.rearRight});
     }
@@ -99,6 +101,7 @@ public class BicycleController : MonoBehaviour
 
     private void Lean()
     {
+
         //reset all wheels to being centered
         if (CurrentLeaningAngle == 0) //TODO: maybe add a threshold for leaning, e.g. < -0.05 and > 0.05 
         {

+ 12 - 8
Assets/Scripts/BicyleController/WheelConfig.cs

@@ -21,17 +21,21 @@ public class WheelConfig
         var posRear = rearWheel.localPosition;
         var newXLeftRear = posRear.x - offset;
         var newXRightRear = posRear.x + offset;
+
+        var transform = frontLeft.transform;
+        var localPosition = transform.localPosition;
+        var newY = localPosition.y;
+        var newZFront = localPosition.z;
+        var newZRear = rearLeft.transform.localPosition.z;
         
-        SetNewX(frontLeft.transform, newXLeftFront);
-        SetNewX(frontRight.transform, newXRightFront);
-        SetNewX(rearLeft.transform, newXLeftRear);
-        SetNewX(rearRight.transform, newXRightRear);
+        SetNewCoords(transform, newXLeftFront, newY, newZFront);
+        SetNewCoords(frontRight.transform, newXRightFront, newY, newZFront);
+        SetNewCoords(rearLeft.transform, newXLeftRear, newY, newZRear);
+        SetNewCoords(rearRight.transform, newXRightRear, newY, newZRear);
     }
 
-    private void SetNewX(Transform transform, float newX)
+    private void SetNewCoords(Transform transform, float newX, float newY, float newZ)
     {
-        var position = transform.localPosition;
-        position = new Vector3(newX, position.y, position.z);
-        transform.localPosition = position;
+        transform.localPosition = new Vector3(newX, newY, newZ);
     }
 }

+ 1 - 0
Packages/manifest.json

@@ -4,6 +4,7 @@
     "com.unity.formats.fbx": "3.2.1-preview.2",
     "com.unity.ide.rider": "1.1.4",
     "com.unity.ide.vscode": "1.2.3",
+    "com.unity.inputsystem": "1.0.1",
     "com.unity.render-pipelines.universal": "7.3.1",
     "com.unity.test-framework": "1.1.18",
     "com.unity.textmeshpro": "2.1.1",

+ 7 - 0
Packages/packages-lock.json

@@ -48,6 +48,13 @@
       "dependencies": {},
       "url": "https://packages.unity.com"
     },
+    "com.unity.inputsystem": {
+      "version": "1.0.1",
+      "depth": 0,
+      "source": "registry",
+      "dependencies": {},
+      "url": "https://packages.unity.com"
+    },
     "com.unity.recorder": {
       "version": "2.2.0-preview.4",
       "depth": 1,

+ 2 - 2
ProjectSettings/ProjectSettings.asset

@@ -17,7 +17,7 @@ PlayerSettings:
   defaultCursor: {fileID: 0}
   cursorHotspot: {x: 0, y: 0}
   m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
-  m_ShowUnitySplashScreen: 0
+  m_ShowUnitySplashScreen: 1
   m_ShowUnitySplashLogo: 1
   m_SplashScreenOverlayOpacity: 1
   m_SplashScreenAnimation: 1
@@ -680,6 +680,6 @@ PlayerSettings:
   projectName: 
   organizationId: 
   cloudEnabled: 0
-  enableNativePlatformBackendsForNewInputSystem: 0
+  enableNativePlatformBackendsForNewInputSystem: 1
   disableOldInputManagerSupport: 0
   legacyClampBlendShapeWeights: 0

+ 1 - 1
ProjectSettings/QualitySettings.asset

@@ -95,7 +95,7 @@ QualitySettings:
     skinWeights: 2
     textureQuality: 0
     anisotropicTextures: 1
-    antiAliasing: 2
+    antiAliasing: 0
     softParticles: 0
     softVegetation: 1
     realtimeReflectionProbes: 1

File diff suppressed because it is too large
+ 0 - 0
SteamVR.csproj


File diff suppressed because it is too large
+ 0 - 0
SteamVR_Editor.csproj


File diff suppressed because it is too large
+ 0 - 0
SteamVR_Input_Editor.csproj


File diff suppressed because it is too large
+ 0 - 0
SteamVR_Windows_EditorHelper.csproj


BIN
obj/Debug/Assembly-CSharp.csprojAssemblyReference.cache


BIN
obj/Debug/SteamVR_Windows_EditorHelper.csprojAssemblyReference.cache


Some files were not shown because too many files changed in this diff