Browse Source

Slope stuff

Marcel 3 years ago
parent
commit
bf3a5b34a1

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

@@ -576,6 +576,7 @@
             <e p="CrossingExtras.cs" t="Include" />
             <e p="JunctionExtras.cs" t="Include" />
             <e p="StraightRoadExtras.cs" t="Include" />
+            <e p="StreetPartMetaTag.cs" t="Include" />
           </e>
           <e p="Routes" t="Include">
             <e p="Route.cs" t="Include" />

+ 45 - 20
.idea/.idea.VRCyling/.idea/workspace.xml

@@ -22,11 +22,20 @@
     <select />
   </component>
   <component name="ChangeListManager">
-    <list default="true" id="ae9d46da-fd77-45ea-9287-d8d155f44bcf" name="Default Changelist" comment="More logging">
+    <list default="true" id="ae9d46da-fd77-45ea-9287-d8d155f44bcf" name="Default Changelist" comment="">
+      <change afterPath="$PROJECT_DIR$/Assets/Scripts/Roads/StreetPartMetaTag.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.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/Assembly-CSharp.csproj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Assets/Prefabs/Roads/Road_Straight_With_Sidewalk.prefab" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Prefabs/Roads/Road_Straight_With_Sidewalk.prefab" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/Assets/Scenes/MainScene.unity" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scenes/MainScene.unity" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/Events/RouteEventLogger.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Events/RouteEventLogger.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Roads/StraightRoadExtras.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Roads/StraightRoadExtras.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Assets/Scripts/SlopeCollider.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/SlopeCollider.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/ProjectSettings/QualitySettings.asset" beforeDir="false" afterPath="$PROJECT_DIR$/ProjectSettings/QualitySettings.asset" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/ProjectSettings/TagManager.asset" beforeDir="false" afterPath="$PROJECT_DIR$/ProjectSettings/TagManager.asset" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/obj/Debug/Assembly-CSharp-Editor.csprojAssemblyReference.cache" beforeDir="false" afterPath="$PROJECT_DIR$/obj/Debug/Assembly-CSharp-Editor.csprojAssemblyReference.cache" 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" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -37,9 +46,11 @@
     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
   </component>
   <component name="HighlightingSettingsPerFile">
+    <setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/FAA55637-FCC1-4BBF-B146-E6835A4641D9/e7/bf98a196/RaycastHit.cs" root0="SKIP_HIGHLIGHTING" />
     <setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/9577AC7A-62EF-4317-9789-031239BA8798/f4/58c7cb9b/ExceptionDispatchInfo.cs" root0="SKIP_HIGHLIGHTING" />
     <setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/3AD0CC86-8BE6-42AC-8D0C-22906BB12DDB/2/Observable.Extensions.cs" root0="SKIP_HIGHLIGHTING" />
     <setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/D6D3AC03-BF86-4882-89C2-EBF3A45CE0A1/f1/98d7e3b9/IObservable`1.cs" root0="SKIP_HIGHLIGHTING" />
+    <setting file="file://$PROJECT_DIR$/Assets/Scripts/Roads/StreetPartMetaTag.cs" root0="FORCE_HIGHLIGHTING" />
     <setting file="file://$PROJECT_DIR$/Assets/Scripts/Animation/BikeAnimation.cs" root0="FORCE_HIGHLIGHTING" />
     <setting file="file://$PROJECT_DIR$/Assets/Scripts/Tracking/KineticLegTracker.cs" root0="FORCE_HIGHLIGHTING" />
     <setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/3AD0CC86-8BE6-42AC-8D0C-22906BB12DDB/36/BehaviorSubject.cs" root0="SKIP_HIGHLIGHTING" />
@@ -47,10 +58,6 @@
   <component name="IdeDocumentHistory">
     <option name="CHANGED_PATHS">
       <list>
-        <option value="$PROJECT_DIR$/Assets/Scripts/Tracking/KineticLegTracker.cs" />
-        <option value="$PROJECT_DIR$/Assets/Editor/CalibratableTrackerEditor.cs" />
-        <option value="$PROJECT_DIR$/Assets/Scripts/Display/ViveTrackerDebugDisplay.cs" />
-        <option value="$PROJECT_DIR$/Assets/Scripts/Controller/Bicycle/IBicycleController.cs" />
         <option value="$PROJECT_DIR$/Assets/Scripts/Controller/Bicycle/RbBicycleController.cs" />
         <option value="$PROJECT_DIR$/Assets/Plotting/PlotFileWriter.cs" />
         <option value="$PROJECT_DIR$/Assets/Plotting/AsyncLogFileWriter.cs" />
@@ -98,6 +105,10 @@
         <option value="$PROJECT_DIR$/Assets/Scripts/Routes/Turn.cs" />
         <option value="$PROJECT_DIR$/Assets/Scripts/Roads/StraightRoadExtras.cs" />
         <option value="$PROJECT_DIR$/Assets/Scripts/Logging/Events/RouteEventLogger.cs" />
+        <option value="$PROJECT_DIR$/Assets/StreetPartMeta.cs" />
+        <option value="$PROJECT_DIR$/Assets/Scripts/Roads/StreetPartMeta.cs" />
+        <option value="$PROJECT_DIR$/Assets/Scripts/Roads/StreetPartMetaTag.cs" />
+        <option value="$PROJECT_DIR$/Assets/Scripts/SlopeCollider.cs" />
       </list>
     </option>
   </component>
@@ -159,7 +170,8 @@
       <workItem from="1608626823380" duration="6475000" />
       <workItem from="1608633384360" duration="3597000" />
       <workItem from="1609928644105" duration="6587000" />
-      <workItem from="1610355346577" duration="6369000" />
+      <workItem from="1610355346577" duration="15843000" />
+      <workItem from="1610431786853" duration="1170000" />
     </task>
     <task id="LOCAL-00001" summary="VR Stuff, Bicycle Animations">
       <created>1606399745852</created>
@@ -224,7 +236,14 @@
       <option name="project" value="LOCAL" />
       <updated>1610361817557</updated>
     </task>
-    <option name="localTasksCounter" value="10" />
+    <task id="LOCAL-00010" summary="Start and Finish events">
+      <created>1610362454731</created>
+      <option name="number" value="00010" />
+      <option name="presentableId" value="LOCAL-00010" />
+      <option name="project" value="LOCAL" />
+      <updated>1610362454731</updated>
+    </task>
+    <option name="localTasksCounter" value="11" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
@@ -255,7 +274,8 @@
     <MESSAGE value="Proper steering calculation" />
     <MESSAGE value="HMD logging" />
     <MESSAGE value="More logging" />
-    <option name="LAST_COMMIT_MESSAGE" value="More logging" />
+    <MESSAGE value="Start and Finish events" />
+    <option name="LAST_COMMIT_MESSAGE" value="Start and Finish events" />
   </component>
   <component name="WindowStateProjectService">
     <state x="188" y="243" key="#xdebugger.evaluate" timestamp="1608637186447">
@@ -374,16 +394,16 @@
     </state>
     <state x="346" y="136" key="SettingsEditor/0.0.1440.860@0.0.1440.860" timestamp="1608627211813" />
     <state x="461" y="164" key="SettingsEditor/0.0.1920.1040@0.0.1920.1040" timestamp="1607347297764" />
-    <state x="69" y="76" width="1302" height="708" key="VCS.FileHistoryDialog" timestamp="1610361149716">
+    <state x="69" y="76" width="1302" height="708" key="VCS.FileHistoryDialog" timestamp="1610365025117">
       <screen x="0" y="0" width="1440" height="860" />
     </state>
-    <state x="69" y="76" width="1302" height="708" key="VCS.FileHistoryDialog/0.0.1440.860@0.0.1440.860" timestamp="1610361149716" />
+    <state x="69" y="76" width="1302" height="708" key="VCS.FileHistoryDialog/0.0.1440.860@0.0.1440.860" timestamp="1610365025117" />
     <state x="69" y="80" width="1302" height="741" key="VCS.FileHistoryDialog/0.0.1440.900@0.0.1440.900" timestamp="1608635342446" />
     <state x="92" y="92" width="1736" height="856" key="VCS.FileHistoryDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1607591027227" />
-    <state x="414" y="208" key="Vcs.Push.Dialog.v2" timestamp="1610361819306">
+    <state x="414" y="208" key="Vcs.Push.Dialog.v2" timestamp="1610362459013">
       <screen x="0" y="0" width="1440" height="860" />
     </state>
-    <state x="414" y="208" key="Vcs.Push.Dialog.v2/0.0.1440.860@0.0.1440.860" timestamp="1610361819306" />
+    <state x="414" y="208" key="Vcs.Push.Dialog.v2/0.0.1440.860@0.0.1440.860" timestamp="1610362459013" />
     <state x="414" y="218" key="Vcs.Push.Dialog.v2/0.0.1440.900@0.0.1440.900" timestamp="1608628624093" />
     <state x="552" y="252" key="Vcs.Push.Dialog.v2/0.0.1920.1040@0.0.1920.1040" timestamp="1607593425704" />
     <state width="726" height="436" key="XDebugger.FullValuePopup" timestamp="1608570184149">
@@ -394,22 +414,27 @@
       <screen x="0" y="0" width="1440" height="900" />
     </state>
     <state x="93" y="93" width="1253" height="713" maximized="true" key="com.intellij.history.integration.ui.views.FileHistoryDialog/0.0.1440.900@0.0.1440.900" timestamp="1608634708861" />
-    <state x="93" y="93" width="1253" height="713" key="com.intellij.history.integration.ui.views.SelectionHistoryDialog" timestamp="1608633349176">
-      <screen x="0" y="0" width="1440" height="900" />
+    <state x="93" y="89" width="1253" height="682" key="com.intellij.history.integration.ui.views.SelectionHistoryDialog" timestamp="1610375404608">
+      <screen x="0" y="0" width="1440" height="860" />
     </state>
+    <state x="93" y="89" width="1253" height="682" key="com.intellij.history.integration.ui.views.SelectionHistoryDialog/0.0.1440.860@0.0.1440.860" timestamp="1610375404608" />
     <state x="93" y="93" width="1253" height="713" key="com.intellij.history.integration.ui.views.SelectionHistoryDialog/0.0.1440.900@0.0.1440.900" timestamp="1608633349176" />
     <state x="332" y="41" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser" timestamp="1610362264361">
       <screen x="0" y="0" width="1440" height="860" />
     </state>
     <state x="332" y="41" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser/0.0.1440.860@0.0.1440.860" timestamp="1610362264361" />
-    <state x="300" y="85" width="1140" height="689" key="editAsTableFormatDialogDimension" timestamp="1610361477789">
+    <state x="300" y="85" width="1140" height="689" key="editAsTableFormatDialogDimension" timestamp="1610362422263">
+      <screen x="0" y="0" width="1440" height="860" />
+    </state>
+    <state x="300" y="85" width="1140" height="689" key="editAsTableFormatDialogDimension/0.0.1440.860@0.0.1440.860" timestamp="1610362422263" />
+    <state x="368" y="29" width="703" height="801" key="find.popup" timestamp="1610363676930">
       <screen x="0" y="0" width="1440" height="860" />
     </state>
-    <state x="300" y="85" width="1140" height="689" key="editAsTableFormatDialogDimension/0.0.1440.860@0.0.1440.860" timestamp="1610361477789" />
-    <state x="368" y="29" width="703" height="801" key="find.popup" timestamp="1610358088077">
+    <state x="368" y="29" width="703" height="801" key="find.popup/0.0.1440.860@0.0.1440.860" timestamp="1610363676930" />
+    <state x="379" y="197" key="run.anything.popup" timestamp="1610374243030">
       <screen x="0" y="0" width="1440" height="860" />
     </state>
-    <state x="368" y="29" width="703" height="801" key="find.popup/0.0.1440.860@0.0.1440.860" timestamp="1610358088077" />
+    <state x="379" y="197" key="run.anything.popup/0.0.1440.860@0.0.1440.860" timestamp="1610374243030" />
     <state x="478" y="197" width="672" height="561" key="search.everywhere.popup" timestamp="1610362007792">
       <screen x="0" y="0" width="1440" height="860" />
     </state>

+ 1 - 0
Assembly-CSharp.csproj

@@ -296,6 +296,7 @@
      <Compile Include="Assets\Scripts\Roads\CrossingExtras.cs" />
      <Compile Include="Assets\Scripts\Roads\JunctionExtras.cs" />
      <Compile Include="Assets\Scripts\Roads\StraightRoadExtras.cs" />
+     <Compile Include="Assets\Scripts\Roads\StreetPartMetaTag.cs" />
      <Compile Include="Assets\Scripts\Routes\Route.cs" />
      <Compile Include="Assets\Scripts\Routes\RouteManager.cs" />
      <Compile Include="Assets\Scripts\Routes\Turn.cs" />

+ 72 - 0
Assets/Prefabs/Roads/Road_Straight_With_Sidewalk.prefab

@@ -1,5 +1,53 @@
 %YAML 1.1
 %TAG !u! tag:unity3d.com,2011:
+--- !u!114 &8177605626345498258
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1009265090087334136}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: a344f689d6cc8dc409ccda69e2b20919, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+--- !u!114 &6542780279660307252
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1009265090222301552}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: a344f689d6cc8dc409ccda69e2b20919, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+--- !u!114 &7117786523730736696
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1009265091147035690}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: a344f689d6cc8dc409ccda69e2b20919, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+--- !u!114 &181081681353772259
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1009265091822558284}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: a344f689d6cc8dc409ccda69e2b20919, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
 --- !u!1 &5454143873828192637
 GameObject:
   m_ObjectHideFlags: 0
@@ -112,6 +160,12 @@ PrefabInstance:
       objectReference: {fileID: 2100000, guid: 9415d5fbf987e4d47b3c90bea3a0d824, type: 2}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 1ac8b9099f0c47e41a84ef1f2e41988c, type: 3}
+--- !u!1 &1009265090087334136 stripped
+GameObject:
+  m_CorrespondingSourceObject: {fileID: 159042, guid: 1ac8b9099f0c47e41a84ef1f2e41988c,
+    type: 3}
+  m_PrefabInstance: {fileID: 1009265090087214522}
+  m_PrefabAsset: {fileID: 0}
 --- !u!4 &1009265090087528978 stripped
 Transform:
   m_CorrespondingSourceObject: {fileID: 489384, guid: 1ac8b9099f0c47e41a84ef1f2e41988c,
@@ -163,6 +217,12 @@ PrefabInstance:
       objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
+--- !u!1 &1009265090222301552 stripped
+GameObject:
+  m_CorrespondingSourceObject: {fileID: 195910, guid: ae7b8255185ace64ca379cb1ca3b24e6,
+    type: 3}
+  m_PrefabInstance: {fileID: 1009265090222218294}
+  m_PrefabAsset: {fileID: 0}
 --- !u!4 &1009265090222068148 stripped
 Transform:
   m_CorrespondingSourceObject: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6,
@@ -214,6 +274,12 @@ PrefabInstance:
       objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
+--- !u!1 &1009265091147035690 stripped
+GameObject:
+  m_CorrespondingSourceObject: {fileID: 195910, guid: ae7b8255185ace64ca379cb1ca3b24e6,
+    type: 3}
+  m_PrefabInstance: {fileID: 1009265091147172204}
+  m_PrefabAsset: {fileID: 0}
 --- !u!4 &1009265091146794222 stripped
 Transform:
   m_CorrespondingSourceObject: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6,
@@ -269,6 +335,12 @@ PrefabInstance:
       objectReference: {fileID: 2100000, guid: 9415d5fbf987e4d47b3c90bea3a0d824, type: 2}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 1ac8b9099f0c47e41a84ef1f2e41988c, type: 3}
+--- !u!1 &1009265091822558284 stripped
+GameObject:
+  m_CorrespondingSourceObject: {fileID: 159042, guid: 1ac8b9099f0c47e41a84ef1f2e41988c,
+    type: 3}
+  m_PrefabInstance: {fileID: 1009265091822711054}
+  m_PrefabAsset: {fileID: 0}
 --- !u!4 &1009265091822749350 stripped
 Transform:
   m_CorrespondingSourceObject: {fileID: 489384, guid: 1ac8b9099f0c47e41a84ef1f2e41988c,

+ 70 - 8
Assets/Scenes/MainScene.unity

@@ -197927,6 +197927,36 @@ Transform:
     type: 3}
   m_PrefabInstance: {fileID: 2041220627}
   m_PrefabAsset: {fileID: 0}
+--- !u!1 &814960440
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 814960441}
+  m_Layer: 9
+  m_Name: RearWheelContact
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &814960441
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 814960440}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: -0, y: -1.0378, z: -1}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_Children: []
+  m_Father: {fileID: 1689915699}
+  m_RootOrder: 7
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1001 &815116921
 PrefabInstance:
   m_ObjectHideFlags: 0
@@ -277247,7 +277277,7 @@ MonoBehaviour:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 1169776434}
-  m_Enabled: 0
+  m_Enabled: 1
   m_EditorHideFlags: 0
   m_Script: {fileID: 11500000, guid: a07e4b04b4ea47678482c4031c354edf, type: 3}
   m_Name: 
@@ -277262,7 +277292,7 @@ MonoBehaviour:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 1169776434}
-  m_Enabled: 0
+  m_Enabled: 1
   m_EditorHideFlags: 0
   m_Script: {fileID: 11500000, guid: 5f54fdda247d4ecfbc16d13e0d835739, type: 3}
   m_Name: 
@@ -277274,7 +277304,7 @@ MonoBehaviour:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 1169776434}
-  m_Enabled: 0
+  m_Enabled: 1
   m_EditorHideFlags: 0
   m_Script: {fileID: 11500000, guid: 7c21e1b2b3d440a096d450f52d3c0b8c, type: 3}
   m_Name: 
@@ -277299,7 +277329,7 @@ MonoBehaviour:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 1169776434}
-  m_Enabled: 0
+  m_Enabled: 1
   m_EditorHideFlags: 0
   m_Script: {fileID: 11500000, guid: 20f5c412b40b43bcbbbf4aa01b9051d1, type: 3}
   m_Name: 
@@ -277324,7 +277354,7 @@ MonoBehaviour:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 1169776434}
-  m_Enabled: 0
+  m_Enabled: 1
   m_EditorHideFlags: 0
   m_Script: {fileID: 11500000, guid: 7004e9fc33cf4027a755ad500cea0ef7, type: 3}
   m_Name: 
@@ -397148,7 +397178,7 @@ SphereCollider:
   m_GameObject: {fileID: 1689915694}
   m_Material: {fileID: 0}
   m_IsTrigger: 0
-  m_Enabled: 0
+  m_Enabled: 1
   serializedVersion: 2
   m_Radius: 1.07
   m_Center: {x: 0, y: 0.025737524, z: 0}
@@ -397198,6 +397228,8 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   collisionLayer: 11
+  rearWheelContactPoint: {fileID: 814960441}
+  frontWheelContactPoint: {fileID: 1862155314}
 --- !u!1001 &1690450701
 PrefabInstance:
   m_ObjectHideFlags: 0
@@ -437412,6 +437444,36 @@ PrefabInstance:
       objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: a8075fecadfce7c4abe277fb835ca5c5, type: 3}
+--- !u!1 &1862155313
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 1862155314}
+  m_Layer: 9
+  m_Name: FrontWheelContact
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &1862155314
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1862155313}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: -0, y: -1.0378, z: 1}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_Children: []
+  m_Father: {fileID: 1689915699}
+  m_RootOrder: 6
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1001 &1862393595
 PrefabInstance:
   m_ObjectHideFlags: 0
@@ -454390,7 +454452,7 @@ PrefabInstance:
     - target: {fileID: 4988978073311274400, guid: 3b07d6594636ab04d9c1fac04c1cde7e,
         type: 3}
       propertyPath: m_Enabled
-      value: 1
+      value: 0
       objectReference: {fileID: 0}
     - target: {fileID: 4988978073311274401, guid: 3b07d6594636ab04d9c1fac04c1cde7e,
         type: 3}
@@ -454460,7 +454522,7 @@ PrefabInstance:
     - target: {fileID: 4988978073311274404, guid: 3b07d6594636ab04d9c1fac04c1cde7e,
         type: 3}
       propertyPath: m_Enabled
-      value: 1
+      value: 0
       objectReference: {fileID: 0}
     - target: {fileID: 4988978073311274404, guid: 3b07d6594636ab04d9c1fac04c1cde7e,
         type: 3}

+ 17 - 0
Assets/Scripts/Roads/StreetPartMetaTag.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class StreetPartMetaTag : MonoBehaviour
+{
+    public const string TAG_EVEN = "street_even";
+    public const string TAG_UNEVEN = "street_uneven";
+
+    private const float SLOPE_THRES = .5f;
+    private void Awake()
+    {
+        var slope = transform.parent.localRotation.eulerAngles.z;
+        tag = Mathf.Abs(slope) <= SLOPE_THRES ? TAG_EVEN : TAG_UNEVEN;
+    }
+}

+ 102 - 46
Assets/Scripts/SlopeCollider.cs

@@ -1,72 +1,128 @@
 using System;
 using UnityEngine;
 
+public enum SlopeDirection
+{
+    Level,
+    Uphill,
+    Downhill
+}
+
+internal struct SlopeHit
+{
+    internal float distance;
+    internal bool even;
+    internal float angle;
+
+    internal SlopeHit(float distance, bool even, float angle)
+    {
+        this.distance = distance;
+        this.even = even;
+        this.angle = angle;
+    }
+
+    public override string ToString()
+    {
+        return $"SlopeHit(distance = {distance}, even = {even}, angle = {angle})";
+    }
+}
 
-[RequireComponent(typeof(BoxCollider))]
 public class SlopeCollider : MonoBehaviour
 {
-    public int collisionLayer = 11;
+    public int collisionLayer = 1;
+    public Transform rearWheelContactPoint;
+    public Transform frontWheelContactPoint;
 
-    private readonly ContactPoint[] contacts = new ContactPoint[4];
+    private const float THRESHOLD = 0f;
     private Transform t;
-    private BoxCollider bikeCollider;
+    private float distRwFw;
+    private SlopeDirection currentSlope = SlopeDirection.Level;
 
     private void Start()
     {
         t = transform;
-        bikeCollider = GetComponent<BoxCollider>();
+        distRwFw = Mathf.Abs(frontWheelContactPoint.localPosition.z - rearWheelContactPoint.localPosition.z);
     }
 
-    private void OnCollisionStay(Collision other)
+    private void FixedUpdate()
     {
-        if (other.gameObject.layer == collisionLayer)
+        var fwContact = frontWheelContactPoint.position;
+        var rwContact = rearWheelContactPoint.position;
+        var fwHit = DrawRay(fwContact);
+        var rwHit = DrawRay(rwContact);
+
+        if ((fwHit?.even ?? true) && (rwHit?.even ?? true)) return;
+
+        if (rwHit.HasValue)
         {
-            var numberOfContacts = other.GetContacts(this.contacts);
-            //Debug.Log($"Has {numberOfContacts} contacts with {other.gameObject.name}");
-            /*foreach (var c in contacts)
+            var rwHitVal = rwHit.Value;
+            if (rwHitVal.angle > 0.01f)
+            {
+                t.RotateAround(fwContact, frontWheelContactPoint.right, -rwHitVal.angle);
+            }
+            /*if (rwHitVal.even)
             {
-                Debug.DrawLine(c.point, c.point + c.normal * 0.5f, Color.red);
+                //begin of slope
+                Rotate(rwHitVal.distance, rwHitVal.distance - (fwHit?.distance ?? 0f), fwContact, rwContact);
             }*/
+        }
 
-            var bounds = bikeCollider.bounds;
-            var leftBackCorner = t.TransformPoint(bikeCollider.center - bikeCollider.size / 2);
-            var localExtends = bikeCollider.size;
-            localExtends.Scale(t.localScale);
-
-            var rightBackCorner = leftBackCorner + t.right * localExtends.x;
-            var forward = t.forward;
-            var leftFrontCorner = leftBackCorner + forward * localExtends.z;
-            var rightFrontCorner = rightBackCorner + forward * localExtends.z;
-
-            var minSide = Helpers.GetMinComponent(localExtends);
-
-            Debug.DrawLine(leftBackCorner, rightBackCorner, Color.red);
-            Debug.DrawLine(leftBackCorner, leftBackCorner + t.up * localExtends.y, Color.green);
-            Debug.DrawLine(leftBackCorner, leftFrontCorner, Color.blue);
-            
-            foreach(var c in contacts)
+        if (fwHit.HasValue)
+        {
+            var fwHitVal = fwHit.Value;
+            if (fwHitVal.angle > 0.01f)
             {
-                if ((leftBackCorner - c.point).magnitude < minSide/2.2f)
-                {
-                   // Debug.Log("Hit LeftBackCorner");
-                }
-                else if ((rightBackCorner - c.point).magnitude < minSide/2.2f)
-                {
-                   // Debug.Log("Hit RightBackCorner");
-                }
-                else if ((leftFrontCorner - c.point).magnitude < minSide/2.2f)
-                {
-                   // Debug.Log("Hit LeftFrontCorner");
-                }
-                else if ((rightFrontCorner - c.point).magnitude < minSide/2.2f)
-                {
-                   // Debug.Log("Hit RightFrontCorner");
-                }
+                t.RotateAround(rwContact, rearWheelContactPoint.right, -fwHitVal.angle);
             }
+            /*if (fwHitVal.even)
+            {
+                //end of slope
+                Rotate(fwHitVal.distance, fwHitVal.distance - (rwHit?.distance ?? 0f), fwContact, rwContact);
+            }*/
+        }
+
+        Debug.Log("----Slope Collider----");
+        Debug.Log($"\tfwHit: {fwHit}");
+        Debug.Log($"\trwHit: {rwHit}");
+    }
+
+    private void Rotate(float dist, float distDif, Vector3 fwContact, Vector3 rwContact)
+    {
+        var angle = Mathf.Atan(dist / distRwFw) * Mathf.Rad2Deg;
 
+        if (distDif < -THRESHOLD) //rwDist > fwDist
+        {
+            //rear wheel in the air -> rotate around front wheel -> make it go uphill
+            currentSlope = SlopeDirection.Uphill;
+            t.RotateAround(fwContact, frontWheelContactPoint.right, -angle);
+        }
+        else if (dist > THRESHOLD)
+        {
+            //front wheel in the air -> rotate around rear wheel
+            currentSlope = SlopeDirection.Downhill;
+            t.RotateAround(rwContact, rearWheelContactPoint.right, angle);
+        }
+    }
 
-            //Debug.Log($"Bounds = {bounds}");
-            //Debug.Log($"LocalCenter = {localCenter}, localExtends = {localExtends}");
+    private SlopeHit? DrawRay(Vector3 start)
+    {
+        var layerMask = 1 << collisionLayer;
+        RaycastHit hit;
+        // Does the ray intersect any objects excluding the player layer
+        if (Physics.Raycast(start, -t.up, out hit, 20f, layerMask))
+        {
+            Debug.DrawRay(start, -t.up * hit.distance, Color.green);
+            Debug.DrawRay(hit.point, hit.normal, Color.blue);
+            var isUneven = hit.collider.gameObject.CompareTag(StreetPartMetaTag.TAG_UNEVEN);
+            var first = -(-t.up * hit.distance);
+            var second = (hit.normal);
+            var angle = Mathf.Acos(Vector3.Dot(first, second) / first.magnitude * second.magnitude) * Mathf.Rad2Deg;
+            Debug.Log("Dot Product: " + Vector3.Dot(first, second));
+            Debug.Log("Angle: " + angle);
+            return new SlopeHit(hit.distance, !isUneven, angle);
         }
+
+        Debug.DrawRay(start, -t.up * 20f, Color.red);
+        return null;
     }
 }

+ 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

+ 2 - 0
ProjectSettings/TagManager.asset

@@ -8,6 +8,8 @@ TagManager:
   - FxTemporaire
   - ArrowPool
   - bike
+  - street_even
+  - street_uneven
   layers:
   - Default
   - TransparentFX

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


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


BIN
obj/Debug/SteamVR_Windows_EditorHelper.csprojAssemblyReference.cache