Browse Source

Primitive steering with Vive Tracker

Marcel Zickler 3 năm trước cách đây
mục cha
commit
42b4378d05

+ 4 - 0
.idea/.idea.VRCyling/.idea/contentModel.xml

@@ -230,6 +230,10 @@
             <e p="SpeedDisplay.cs" t="Include" />
           </e>
         </e>
+        <e p="Editor" t="Include">
+          <e p="FrontWheelTrackerEditor.cs" t="Include" />
+        </e>
+        <e p="FrontWheelTracker.cs" t="Include" />
         <e p="InputActions" t="Include">
           <e p="InputMaster.cs" t="Include" />
         </e>

+ 29 - 28
.idea/.idea.VRCyling/.idea/workspace.xml

@@ -19,32 +19,16 @@
     <select />
   </component>
   <component name="ChangeListManager">
-    <list default="true" id="ae9d46da-fd77-45ea-9287-d8d155f44bcf" name="Default Changelist" comment="VR Stuff, Bicycle Animations">
-      <change afterPath="$PROJECT_DIR$/Assets/Scripts/ResetPlayerPosition/PersistatePlayerPosition.cs" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/UserSettings/EditorUserSettings.asset" afterDir="false" />
+    <list default="true" id="ae9d46da-fd77-45ea-9287-d8d155f44bcf" name="Default Changelist" comment="persistate player position and vr bike data display">
+      <change afterPath="$PROJECT_DIR$/Assets/Editor.meta" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Assets/Editor/FrontWheelTrackerEditor.cs" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Assets/Editor/FrontWheelTrackerEditor.cs.meta" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Assets/FrontWheelTracker.cs" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/.idea.VRCyling/.idea/contentModel.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.VRCyling/.idea/contentModel.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/.idea/.idea.VRCyling/.idea/indexLayout.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.VRCyling/.idea/indexLayout.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/.idea.VRCyling/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.VRCyling/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/Assembly-CSharp-Editor.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/Assembly-CSharp-Editor.csproj" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/Assembly-CSharp.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/Assembly-CSharp.csproj" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/GamepadBikeController.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/BicyleController/GamepadBikeController.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/GamepadBikeController.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/BicyleController/GamepadBikeController.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Plotting/plots.meta" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/BikeReset.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/ResetPlayerPosition/BikeReset.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/BikeReset.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/ResetPlayerPosition/BikeReset.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/ResetPlayerPosition/AttachBikeToHead.cs" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/ResetPlayerPosition/AttachBikeToHead.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/ResetPlayerPosition/PersistatePlayerPosition.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/ResetPlayerPosition/ResetPositionViaTransforms.cs" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/ResetPlayerPosition/ResetPositionViaTransforms.cs.meta" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/ResetPlayerPosition/ResetPositionViaValveSDk.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/ResetPlayerPosition/MovePlayerPosition.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/ResetPlayerPosition/ResetPositionViaValveSDk.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/ResetPlayerPosition/MovePlayerPosition.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Packages/packages-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/Packages/packages-lock.json" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/SteamVR.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/SteamVR.csproj" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/SteamVR_Editor.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/SteamVR_Editor.csproj" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/SteamVR_Input_Editor.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/SteamVR_Input_Editor.csproj" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/SteamVR_Windows_EditorHelper.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/SteamVR_Windows_EditorHelper.csproj" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/obj/Debug/Assembly-CSharp.csprojAssemblyReference.cache" beforeDir="false" afterPath="$PROJECT_DIR$/obj/Debug/Assembly-CSharp.csprojAssemblyReference.cache" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/obj/Debug/SteamVR_Windows_EditorHelper.csprojAssemblyReference.cache" beforeDir="false" afterPath="$PROJECT_DIR$/obj/Debug/SteamVR_Windows_EditorHelper.csprojAssemblyReference.cache" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Assets/Scripts/BicyleController/SensorBikeController.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/BicyleController/SensorBikeController.cs" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -55,15 +39,17 @@
     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
   </component>
   <component name="HighlightingSettingsPerFile">
+    <setting file="file://$PROJECT_DIR$/Assets/FrontWheelTracker.cs" root0="FORCE_HIGHLIGHTING" />
     <setting file="file://$PROJECT_DIR$/Assets/Scripts/Animation/BikeAnimation.cs" root0="FORCE_HIGHLIGHTING" />
+    <setting file="file://$PROJECT_DIR$/Library/PackageCache/com.unity.inputsystem@1.0.1/InputSystem/Utilities/PrimitiveValue.cs" root0="SKIP_HIGHLIGHTING" />
     <setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/526469D5-A48C-43EE-BD9A-F19F8745AFA1/68/360ad80c/PlayerPrefs.cs" root0="SKIP_HIGHLIGHTING" />
+    <setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/A8E33794-C006-4F2A-A201-ADE069162226/7e/d8f633a7/EditorGUILayout.cs" root0="SKIP_HIGHLIGHTING" />
     <setting file="file://$PROJECT_DIR$/Assets/Scripts/ResetPlayerPosition/BikeReset.cs" root0="FORCE_HIGHLIGHTING" />
   </component>
   <component name="IdeDocumentHistory">
     <option name="CHANGED_PATHS">
       <list>
         <option value="$PROJECT_DIR$/Assets/ColliderActivation.cs" />
-        <option value="$PROJECT_DIR$/Assets/Scripts/BicyleController/SensorBikeController.cs" />
         <option value="$PROJECT_DIR$/Assets/ViveBikeController.cs" />
         <option value="$PROJECT_DIR$/Assets/Scripts/BikeReset.cs" />
         <option value="$PROJECT_DIR$/Assets/Scripts/BicyleController/ViveBikeController.cs" />
@@ -74,6 +60,9 @@
         <option value="$PROJECT_DIR$/Assets/Scripts/ResetPlayerPosition/ResetPositionViaValveSDk.cs" />
         <option value="$PROJECT_DIR$/Assets/Scripts/ResetPlayerPosition/MovePlayerPosition.cs" />
         <option value="$PROJECT_DIR$/Assets/Scripts/ResetPlayerPosition/PersistatePlayerPosition.cs" />
+        <option value="$PROJECT_DIR$/Assets/FrontWheelTracker.cs" />
+        <option value="$PROJECT_DIR$/Assets/Editor/FrontWheelTrackerEditor.cs" />
+        <option value="$PROJECT_DIR$/Assets/Scripts/BicyleController/SensorBikeController.cs" />
       </list>
     </option>
   </component>
@@ -123,7 +112,7 @@
       <option name="presentableId" value="Default" />
       <updated>1606388694739</updated>
       <workItem from="1606388712651" duration="10566000" />
-      <workItem from="1607346787506" duration="735000" />
+      <workItem from="1607346787506" duration="3753000" />
     </task>
     <task id="LOCAL-00001" summary="VR Stuff, Bicycle Animations">
       <created>1606399745852</created>
@@ -132,7 +121,14 @@
       <option name="project" value="LOCAL" />
       <updated>1606399745852</updated>
     </task>
-    <option name="localTasksCounter" value="2" />
+    <task id="LOCAL-00002" summary="persistate player position and vr bike data display">
+      <created>1607347764330</created>
+      <option name="number" value="00002" />
+      <option name="presentableId" value="LOCAL-00002" />
+      <option name="project" value="LOCAL" />
+      <updated>1607347764330</updated>
+    </task>
+    <option name="localTasksCounter" value="3" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
@@ -156,17 +152,22 @@
     <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
     <option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
     <MESSAGE value="VR Stuff, Bicycle Animations" />
-    <option name="LAST_COMMIT_MESSAGE" value="VR Stuff, Bicycle Animations" />
+    <MESSAGE value="persistate player position and vr bike data display" />
+    <option name="LAST_COMMIT_MESSAGE" value="persistate player position and vr bike data display" />
   </component>
   <component name="WindowStateProjectService">
+    <state x="764" y="193" key="RiderGenerateDialog" timestamp="1607351549263">
+      <screen x="0" y="0" width="1920" height="1040" />
+    </state>
+    <state x="764" y="193" key="RiderGenerateDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1607351549263" />
     <state x="461" y="164" key="SettingsEditor" timestamp="1607347297764">
       <screen x="0" y="0" width="1920" height="1040" />
     </state>
     <state x="461" y="164" key="SettingsEditor/0.0.1920.1040@0.0.1920.1040" timestamp="1607347297764" />
-    <state x="552" y="252" key="Vcs.Push.Dialog.v2" timestamp="1606399748151">
+    <state x="552" y="252" key="Vcs.Push.Dialog.v2" timestamp="1607347765922">
       <screen x="0" y="0" width="1920" height="1040" />
     </state>
-    <state x="552" y="252" key="Vcs.Push.Dialog.v2/0.0.1920.1040@0.0.1920.1040" timestamp="1606399748151" />
+    <state x="552" y="252" key="Vcs.Push.Dialog.v2/0.0.1920.1040@0.0.1920.1040" timestamp="1607347765922" />
     <state x="623" y="225" width="672" height="678" key="search.everywhere.popup" timestamp="1606398194772">
       <screen x="0" y="0" width="1920" height="1040" />
     </state>

+ 1 - 0
Assembly-CSharp-Editor.csproj

@@ -58,6 +58,7 @@
     </Reference>
   </ItemGroup>
   <ItemGroup>
+     <Compile Include="Assets\Editor\FrontWheelTrackerEditor.cs" />
      <Compile Include="Assets\TutorialInfo\Scripts\Editor\ReadmeEditor.cs" />
  <Reference Include="UnityEditor.TestRunner">
  <HintPath>C:/Users/student/Desktop/VRCyling/Library/ScriptAssemblies/UnityEditor.TestRunner.dll</HintPath>

+ 1 - 0
Assembly-CSharp.csproj

@@ -250,6 +250,7 @@
      <Compile Include="Assets\AdvancedAnt\Scripts\PowerMeterDisplay.cs" />
      <Compile Include="Assets\AdvancedAnt\Scripts\SpeedCadenceDisplay.cs" />
      <Compile Include="Assets\AdvancedAnt\Scripts\SpeedDisplay.cs" />
+     <Compile Include="Assets\FrontWheelTracker.cs" />
      <Compile Include="Assets\InputActions\InputMaster.cs" />
      <Compile Include="Assets\OverrideLeaningController.cs" />
      <Compile Include="Assets\Plotting\DebugPlot.cs" />

+ 3 - 0
Assets/Editor.meta

@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: c9ac6383d47a4ea99b8a3d535b36791b
+timeCreated: 1607350557

+ 26 - 0
Assets/Editor/FrontWheelTrackerEditor.cs

@@ -0,0 +1,26 @@
+using System;
+using UnityEditor;
+using UnityEngine;
+
+[CustomEditor(typeof(FrontWheelTracker))]
+public class FrontWheelTrackerEditor : Editor
+{
+    public override void OnInspectorGUI()
+    {
+        var fwt = (FrontWheelTracker) target;
+        DrawDefaultInspector();
+        
+        EditorGUILayout.LabelField("Zero Rot:", fwt.ZeroRot.ToString());
+        EditorGUILayout.LabelField("Zero Pos:", fwt.ZeroPos.ToString());
+        
+        EditorGUILayout.Space();
+        EditorGUILayout.LabelField("Relative Position", fwt.Position.ToString());
+        EditorGUILayout.LabelField("Relative Rotation", fwt.Rotation.ToString());
+        
+        EditorGUILayout.LabelField("Attach Vive Tracker to Wheel and press Button to calibrate");
+        if (GUILayout.Button("Calibrate"))
+        {
+            fwt.Calibrate();
+        }
+    }
+}

+ 3 - 0
Assets/Editor/FrontWheelTrackerEditor.cs.meta

@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 61b5d126eb28442384aac9dce1d942c0
+timeCreated: 1607350554

+ 66 - 0
Assets/FrontWheelTracker.cs

@@ -0,0 +1,66 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class FrontWheelTracker : MonoBehaviour
+{
+    private const String KEY_POS_X = "vive_tracker_pos_x";
+    private const String KEY_POS_Y = "vive_tracker_pos_y";
+    private const String KEY_POS_Z = "vive_tracker_pos_z";
+    private const String KEY_ROT_X = "vive_tracker_rot_x";
+    private const String KEY_ROT_Y = "vive_tracker_rot_y";
+    private const String KEY_ROT_Z = "vive_tracker_rot_z";
+
+    private Transform trackerTransform;
+    private Vector3 zeroRot;
+    private Vector3 zeroPos;
+
+    public Vector3 Rotation => trackerTransform.rotation.eulerAngles - zeroRot;
+    public Vector3 Position => trackerTransform.position - zeroPos;
+    public Vector3 ZeroRot => zeroRot;
+
+    public Vector3 ZeroPos => zeroPos;
+
+    // Start is called before the first frame update
+    void Start()
+    {
+        trackerTransform = transform;
+        if (PlayerPrefs.HasKey(KEY_POS_X) && PlayerPrefs.HasKey(KEY_POS_Y) && PlayerPrefs.HasKey(KEY_POS_Z))
+        {
+            var x = PlayerPrefs.GetFloat(KEY_POS_X);
+            var y = PlayerPrefs.GetFloat(KEY_POS_Y);
+            var z = PlayerPrefs.GetFloat(KEY_POS_Z);
+
+            zeroPos = new Vector3(x, y, z);
+        }
+
+        if (PlayerPrefs.HasKey(KEY_ROT_X) && PlayerPrefs.HasKey(KEY_ROT_Y) && PlayerPrefs.HasKey(KEY_ROT_Z))
+        {
+            var x = PlayerPrefs.GetFloat(KEY_ROT_X);
+            var y = PlayerPrefs.GetFloat(KEY_ROT_Y);
+            var z = PlayerPrefs.GetFloat(KEY_ROT_Z);
+
+            zeroRot = new Vector3(x, y, z);
+        }
+    }
+
+    // Update is called once per frame
+    void Update()
+    {
+    }
+
+    //sets current position as zero -> straighten handlebar and call this function
+    public void Calibrate()
+    {
+        zeroRot = trackerTransform.rotation.eulerAngles;
+        zeroPos = trackerTransform.position;
+        PlayerPrefs.SetFloat(KEY_ROT_X, zeroRot.x);
+        PlayerPrefs.SetFloat(KEY_ROT_Y, zeroRot.y);
+        PlayerPrefs.SetFloat(KEY_ROT_Z, zeroRot.z);
+        PlayerPrefs.SetFloat(KEY_POS_X, zeroPos.x);
+        PlayerPrefs.SetFloat(KEY_POS_Y, zeroPos.y);
+        PlayerPrefs.SetFloat(KEY_POS_Z, zeroPos.z);
+        PlayerPrefs.Save();
+    }
+}

+ 11 - 0
Assets/FrontWheelTracker.cs.meta

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

+ 135 - 12
Assets/Scenes/MainScene.unity

@@ -67162,8 +67162,9 @@ MonoBehaviour:
     plotAcc: 0
     plotEcg: 0
     accSampleRate: 200
-  steer: 0
-  accelerate: 0
+  frontWheelTracker: {fileID: 617407327}
+  steer: 1
+  accelerate: 1
   lean: 1
 --- !u!114 &495763390
 MonoBehaviour:
@@ -67244,7 +67245,7 @@ MonoBehaviour:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 495763387}
-  m_Enabled: 1
+  m_Enabled: 0
   m_EditorHideFlags: 0
   m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3}
   m_Name: 
@@ -67275,7 +67276,7 @@ MonoBehaviour:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 495763387}
-  m_Enabled: 1
+  m_Enabled: 0
   m_EditorHideFlags: 0
   m_Script: {fileID: 11500000, guid: 512442fc2be9462480455b716456ef5d, type: 3}
   m_Name: 
@@ -67298,7 +67299,7 @@ MonoBehaviour:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 495763387}
-  m_Enabled: 1
+  m_Enabled: 0
   m_EditorHideFlags: 0
   m_Script: {fileID: 11500000, guid: 1c898ad362c5f694b9f10256b4bdb616, type: 3}
   m_Name: 
@@ -82708,6 +82709,127 @@ PrefabInstance:
       objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: a8075fecadfce7c4abe277fb835ca5c5, type: 3}
+--- !u!1 &617407321
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 617407322}
+  - component: {fileID: 617407326}
+  - component: {fileID: 617407325}
+  - component: {fileID: 617407324}
+  - component: {fileID: 617407323}
+  - component: {fileID: 617407327}
+  m_Layer: 9
+  m_Name: FWViveTracker
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &617407322
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 617407321}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: -0.521, z: 1.469}
+  m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
+  m_Children: []
+  m_Father: {fileID: 1445554698}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &617407323
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 617407321}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: d37c2cf88f7c59f4c8cf5d3812568143, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  index: 4
+  origin: {fileID: 0}
+--- !u!135 &617407324
+SphereCollider:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 617407321}
+  m_Material: {fileID: 0}
+  m_IsTrigger: 0
+  m_Enabled: 1
+  serializedVersion: 2
+  m_Radius: 0.5
+  m_Center: {x: 0, y: 0, z: 0}
+--- !u!23 &617407325
+MeshRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 617407321}
+  m_Enabled: 1
+  m_CastShadows: 1
+  m_ReceiveShadows: 1
+  m_DynamicOccludee: 1
+  m_MotionVectors: 1
+  m_LightProbeUsage: 1
+  m_ReflectionProbeUsage: 1
+  m_RayTracingMode: 2
+  m_RenderingLayerMask: 1
+  m_RendererPriority: 0
+  m_Materials:
+  - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
+  m_StaticBatchInfo:
+    firstSubMesh: 0
+    subMeshCount: 0
+  m_StaticBatchRoot: {fileID: 0}
+  m_ProbeAnchor: {fileID: 0}
+  m_LightProbeVolumeOverride: {fileID: 0}
+  m_ScaleInLightmap: 1
+  m_ReceiveGI: 1
+  m_PreserveUVs: 0
+  m_IgnoreNormalsForChartDetection: 0
+  m_ImportantGI: 0
+  m_StitchLightmapSeams: 1
+  m_SelectedEditorRenderState: 3
+  m_MinimumChartSize: 4
+  m_AutoUVMaxDistance: 0.5
+  m_AutoUVMaxAngle: 89
+  m_LightmapParameters: {fileID: 0}
+  m_SortingLayerID: 0
+  m_SortingLayer: 0
+  m_SortingOrder: 0
+--- !u!33 &617407326
+MeshFilter:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 617407321}
+  m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!114 &617407327
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 617407321}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 0b2e9c24ec19f1b4591081041bc5a931, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
 --- !u!1001 &617608821
 PrefabInstance:
   m_ObjectHideFlags: 0
@@ -96115,7 +96237,7 @@ Transform:
   m_LocalScale: {x: 4.1654, y: 1.7562, z: 3.2095}
   m_Children: []
   m_Father: {fileID: 1445554698}
-  m_RootOrder: 4
+  m_RootOrder: 5
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!65 &705762940
 BoxCollider:
@@ -108164,7 +108286,7 @@ Transform:
   - {fileID: 1053385333}
   - {fileID: 1104579083}
   m_Father: {fileID: 1445554698}
-  m_RootOrder: 3
+  m_RootOrder: 4
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1001 &806758243
 PrefabInstance:
@@ -175186,7 +175308,7 @@ Transform:
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_Children: []
   m_Father: {fileID: 1445554698}
-  m_RootOrder: 1
+  m_RootOrder: 2
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1001 &1344456188
 PrefabInstance:
@@ -189726,6 +189848,7 @@ Transform:
   m_LocalPosition: {x: 0, y: 0.54999, z: 0}
   m_LocalScale: {x: 0.5000001, y: 0.5, z: 0.5000001}
   m_Children:
+  - {fileID: 617407322}
   - {fileID: 1773753918}
   - {fileID: 1344013520}
   - {fileID: 1817007193}
@@ -189757,7 +189880,7 @@ MonoBehaviour:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 1445554695}
-  m_Enabled: 0
+  m_Enabled: 1
   m_EditorHideFlags: 0
   m_Script: {fileID: 11500000, guid: d6587a2241661434db9d2b2ae41cf80a, type: 3}
   m_Name: 
@@ -231715,7 +231838,7 @@ Transform:
   - {fileID: 1990711642}
   - {fileID: 731889963}
   m_Father: {fileID: 1445554698}
-  m_RootOrder: 0
+  m_RootOrder: 1
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!4 &1774265933 stripped
 Transform:
@@ -237696,7 +237819,7 @@ Transform:
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_Children: []
   m_Father: {fileID: 1445554698}
-  m_RootOrder: 2
+  m_RootOrder: 3
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1001 &1817018698
 PrefabInstance:
@@ -255868,7 +255991,7 @@ PrefabInstance:
       objectReference: {fileID: 0}
     - target: {fileID: 447954, guid: dc06161b6d97feb419f45f03b62e14b9, type: 3}
       propertyPath: m_RootOrder
-      value: 5
+      value: 6
       objectReference: {fileID: 0}
     - target: {fileID: 447954, guid: dc06161b6d97feb419f45f03b62e14b9, type: 3}
       propertyPath: m_LocalEulerAnglesHint.x

+ 13 - 0
Assets/Scripts/BicyleController/SensorBikeController.cs

@@ -17,6 +17,7 @@ public class SensorBikeController : MonoBehaviour
 
     public SpeedSensorConfig speedSensorConfig;
     public PolarSensorConfig polarSensorConfig;
+    public FrontWheelTracker frontWheelTracker;
 
     public bool steer = true;
     public bool accelerate = true;
@@ -25,9 +26,11 @@ public class SensorBikeController : MonoBehaviour
     private BicycleController bicycleController;
     private BikeSensorData sensorData;
     private float leanFactor;
+    private bool isFrontWheelTrackerNotNull;
 
     private async void Start()
     {
+        isFrontWheelTrackerNotNull = frontWheelTracker != null;
         bicycleController = GetComponent<BicycleController>();
         sensorData = BikeSensorData.Instance;
         await sensorData.StartListening(polarSensorConfig: polarSensorConfig, speedSensorConfig: speedSensorConfig);
@@ -44,12 +47,22 @@ public class SensorBikeController : MonoBehaviour
             SetSpeed(speedData.Value);
         }
 
+        if (isFrontWheelTrackerNotNull && steer)
+        {
+            SetSteer();
+        }
+
         if (polarData != null && lean)
         {
             SetLeaningAngle(polarData.Value);
         }
     }
 
+    private void SetSteer()
+    {
+        bicycleController.CurrentSteerAngle = frontWheelTracker.Rotation.y; //TODO: something a bit smarter
+    }
+
     private void OnDestroy()
     {
         sensorData.Dispose();