Commit 936a9011 authored by Danial KordModanlou's avatar Danial KordModanlou

distance system updated

parent 098c4aaa
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<Path>.vs</Path> <Path>.vs</Path>
<Path>Library</Path> <Path>Library</Path>
<Path>Logs</Path> <Path>Logs</Path>
<Path>Temp</Path>
<Path>obj</Path> <Path>obj</Path>
</explicitExcludes> </explicitExcludes>
</component> </component>
......
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="63a78b22-9aa4-4157-97bc-72b63425d4fc" name="Default Changelist" comment=""> <list default="true" id="63a78b22-9aa4-4157-97bc-72b63425d4fc" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.car-sim-remaster/.idea/indexLayout.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.car-sim-remaster/.idea/indexLayout.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/.idea.car-sim-remaster/.idea/indexLayout.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.car-sim-remaster/.idea/indexLayout.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.car-sim-remaster/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.car-sim-remaster/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/CSV/p1.csv" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/CSV/p1.csv" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Assets/CSV/p1.csv" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/CSV/p1.csv" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/scripts/DataSaver.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/scripts/DataSaver.cs" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Assets/Scenes/SampleScene.unity" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scenes/SampleScene.unity" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/scripts/Wall.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/scripts/Wall.cs" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Assets/scripts/Wall.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/scripts/Wall.cs" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
...@@ -29,11 +30,11 @@ ...@@ -29,11 +30,11 @@
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Assets/scripts/DataSaver.cs"> <entry file="file://$PROJECT_DIR$/Assets/scripts/DataSaver.cs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="332"> <state relative-caret-position="177">
<caret line="116" column="44" selection-start-line="116" selection-start-column="44" selection-end-line="116" selection-end-column="44" /> <caret line="102" column="7" selection-start-line="102" selection-start-column="7" selection-end-line="102" selection-end-column="7" />
<folding> <folding>
<marker date="1593164590767" expanded="true" signature="7:181" ph="..." /> <marker date="1593164590767" expanded="true" signature="7:181" ph="..." />
<marker date="1593164590767" expanded="true" signature="221:6851" ph="{...}" /> <marker date="1593164590767" expanded="true" signature="221:6851" ph="{...}" />
...@@ -83,22 +84,22 @@ ...@@ -83,22 +84,22 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/Assets/scripts/Wall.cs"> <entry file="file://$PROJECT_DIR$/Assets/scripts/Wall.cs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="312"> <state relative-caret-position="371">
<caret line="82" column="27" selection-start-line="82" selection-start-column="27" selection-end-line="82" selection-end-column="27" /> <caret line="79" column="17" selection-start-line="79" selection-start-column="8" selection-end-line="79" selection-end-column="17" />
<folding> <folding>
<marker date="1593164435901" expanded="true" signature="6:111" ph="..." /> <marker date="1593182337612" expanded="true" signature="6:111" ph="..." />
<marker date="1593164435901" expanded="true" signature="205:2573" ph="{...}" /> <marker date="1593182337612" expanded="true" signature="205:2815" ph="{...}" />
<marker date="1593164435901" expanded="true" signature="404:560" ph="{...}" /> <marker date="1593182337612" expanded="true" signature="404:560" ph="{...}" />
<marker date="1593164435901" expanded="true" signature="607:941" ph="{...}" /> <marker date="1593182337612" expanded="true" signature="607:1103" ph="{...}" />
<marker date="1593164435901" expanded="true" signature="1037:1104" ph="{...}" /> <marker date="1593182337612" expanded="true" signature="1199:1298" ph="{...}" />
<marker date="1593164435901" expanded="true" signature="1188:2390" ph="{...}" /> <marker date="1593182337612" expanded="true" signature="1382:2632" ph="{...}" />
<marker date="1593164435901" expanded="true" signature="1558:1960" ph="{...}" /> <marker date="1593182337612" expanded="true" signature="1752:2154" ph="{...}" />
<marker date="1593164435901" expanded="true" signature="1698:1808" ph="{...}" /> <marker date="1593182337612" expanded="true" signature="1892:2002" ph="{...}" />
<marker date="1593164435901" expanded="true" signature="1860:1950" ph="{...}" /> <marker date="1593182337612" expanded="true" signature="2054:2144" ph="{...}" />
<marker date="1593164435901" expanded="true" signature="2426:2566" ph="{...}" /> <marker date="1593182337612" expanded="true" signature="2668:2808" ph="{...}" />
</folding> </folding>
</state> </state>
</provider> </provider>
...@@ -440,8 +441,8 @@ ...@@ -440,8 +441,8 @@
<option value="$PROJECT_DIR$/Assets/scripts/CarCustom.cs" /> <option value="$PROJECT_DIR$/Assets/scripts/CarCustom.cs" />
<option value="$PROJECT_DIR$/Assets/TurnTheGameOn/IK Driver/Scripts/Utility/IKD_DemoController.cs" /> <option value="$PROJECT_DIR$/Assets/TurnTheGameOn/IK Driver/Scripts/Utility/IKD_DemoController.cs" />
<option value="$PROJECT_DIR$/Assets/scripts/menuSystem.cs" /> <option value="$PROJECT_DIR$/Assets/scripts/menuSystem.cs" />
<option value="$PROJECT_DIR$/Assets/scripts/Wall.cs" />
<option value="$PROJECT_DIR$/Assets/scripts/DataSaver.cs" /> <option value="$PROJECT_DIR$/Assets/scripts/DataSaver.cs" />
<option value="$PROJECT_DIR$/Assets/scripts/Wall.cs" />
</list> </list>
</option> </option>
</component> </component>
...@@ -540,12 +541,12 @@ ...@@ -540,12 +541,12 @@
<workItem from="1593094252552" duration="2199000" /> <workItem from="1593094252552" duration="2199000" />
<workItem from="1593109187851" duration="1718000" /> <workItem from="1593109187851" duration="1718000" />
<workItem from="1593113545384" duration="1808000" /> <workItem from="1593113545384" duration="1808000" />
<workItem from="1593157840945" duration="5288000" /> <workItem from="1593157840945" duration="9231000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="64259000" /> <option name="totallyTimeSpent" value="68202000" />
</component> </component>
<component name="TodoView"> <component name="TodoView">
<todo-panel id="selected-file"> <todo-panel id="selected-file">
...@@ -557,7 +558,7 @@ ...@@ -557,7 +558,7 @@
</todo-panel> </todo-panel>
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-7" y="-7" width="1550" height="838" extended-state="7" /> <frame x="-7" y="-7" width="1550" height="838" extended-state="6" />
<layout> <layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.3286385" /> <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.3286385" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" /> <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
...@@ -1178,29 +1179,10 @@ ...@@ -1178,29 +1179,10 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/Assets/scripts/Wall.cs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="312">
<caret line="82" column="27" selection-start-line="82" selection-start-column="27" selection-end-line="82" selection-end-column="27" />
<folding>
<marker date="1593164435901" expanded="true" signature="6:111" ph="..." />
<marker date="1593164435901" expanded="true" signature="205:2573" ph="{...}" />
<marker date="1593164435901" expanded="true" signature="404:560" ph="{...}" />
<marker date="1593164435901" expanded="true" signature="607:941" ph="{...}" />
<marker date="1593164435901" expanded="true" signature="1037:1104" ph="{...}" />
<marker date="1593164435901" expanded="true" signature="1188:2390" ph="{...}" />
<marker date="1593164435901" expanded="true" signature="1558:1960" ph="{...}" />
<marker date="1593164435901" expanded="true" signature="1698:1808" ph="{...}" />
<marker date="1593164435901" expanded="true" signature="1860:1950" ph="{...}" />
<marker date="1593164435901" expanded="true" signature="2426:2566" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Assets/scripts/DataSaver.cs"> <entry file="file://$PROJECT_DIR$/Assets/scripts/DataSaver.cs">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="332"> <state relative-caret-position="177">
<caret line="116" column="44" selection-start-line="116" selection-start-column="44" selection-end-line="116" selection-end-column="44" /> <caret line="102" column="7" selection-start-line="102" selection-start-column="7" selection-end-line="102" selection-end-column="7" />
<folding> <folding>
<marker date="1593164590767" expanded="true" signature="7:181" ph="..." /> <marker date="1593164590767" expanded="true" signature="7:181" ph="..." />
<marker date="1593164590767" expanded="true" signature="221:6851" ph="{...}" /> <marker date="1593164590767" expanded="true" signature="221:6851" ph="{...}" />
...@@ -1231,5 +1213,24 @@ ...@@ -1231,5 +1213,24 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/Assets/scripts/Wall.cs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="371">
<caret line="79" column="17" selection-start-line="79" selection-start-column="8" selection-end-line="79" selection-end-column="17" />
<folding>
<marker date="1593182337612" expanded="true" signature="6:111" ph="..." />
<marker date="1593182337612" expanded="true" signature="205:2815" ph="{...}" />
<marker date="1593182337612" expanded="true" signature="404:560" ph="{...}" />
<marker date="1593182337612" expanded="true" signature="607:1103" ph="{...}" />
<marker date="1593182337612" expanded="true" signature="1199:1298" ph="{...}" />
<marker date="1593182337612" expanded="true" signature="1382:2632" ph="{...}" />
<marker date="1593182337612" expanded="true" signature="1752:2154" ph="{...}" />
<marker date="1593182337612" expanded="true" signature="1892:2002" ph="{...}" />
<marker date="1593182337612" expanded="true" signature="2054:2144" ph="{...}" />
<marker date="1593182337612" expanded="true" signature="2668:2808" ph="{...}" />
</folding>
</state>
</provider>
</entry>
</component> </component>
</project> </project>
\ No newline at end of file
This diff is collapsed.
...@@ -26,11 +26,13 @@ public class Wall : MonoBehaviour ...@@ -26,11 +26,13 @@ public class Wall : MonoBehaviour
public Vector3 distanceToCar(Vector3 car) public Vector3 distanceToCar(Vector3 car)
{ {
car = transform.InverseTransformPoint(car); //car = transform.InverseTransformPoint(car);
Debug.Log(GetComponent<MeshCollider>().name); Debug.Log(GetComponent<MeshCollider>().name);
Vector3 closestPoint = GetComponent<MeshCollider>().ClosestPointOnBounds(car); Vector3 closestPoint = this.transform.GetComponent<MeshCollider>().ClosestPointOnBounds(car);
Debug.Log("--> "+ car +" " +transform.TransformPoint(closestPoint)); Debug.Log("--> "+ car +" " +transform.TransformPoint(closestPoint));
lastPos = closestPoint;//transform.TransformPoint(closestPoint);//closestPoint;
lastPoint = car;//transform.TransformPoint(car);
return closestPoint; return closestPoint;
} }
...@@ -41,6 +43,7 @@ public class Wall : MonoBehaviour ...@@ -41,6 +43,7 @@ public class Wall : MonoBehaviour
public void newMethod(Vector3 point,Action<Vector3,float> onComplete) public void newMethod(Vector3 point,Action<Vector3,float> onComplete)
{ {
// distanceToCar(point);
StartCoroutine(findVertex(point, onComplete)); StartCoroutine(findVertex(point, onComplete));
} }
...@@ -73,14 +76,15 @@ public class Wall : MonoBehaviour ...@@ -73,14 +76,15 @@ public class Wall : MonoBehaviour
} }
} }
// convert nearest vertex back to world space // convert nearest vertex back to world space
lastPos = transform.TransformPoint(nearestVertex);
Debug.Log("--> "+ point +" " +minDistanceSqr + " " + transform.TransformPoint(nearestVertex)); lastPoint = transform.TransformPoint(point);
minDistanceSqr = Vector3.Distance(transform.TransformPoint(nearestVertex), lastPoint);
Debug.Log("--> "+ point +" " +minDistanceSqr + " " );
onComplete(transform.TransformPoint(nearestVertex), minDistanceSqr); onComplete(transform.TransformPoint(nearestVertex), minDistanceSqr);
lastPos = transform.TransformPoint(nearestVertex); // Debug.Log(lastPoint);
lastPoint = transform.TransformPoint(point);
Debug.Log(lastPoint);
yield break; yield break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment