Commit 00bf3526 authored by kash's avatar kash

side distance

parent 7081f84e
...@@ -124,6 +124,7 @@ ...@@ -124,6 +124,7 @@
<Compile Include="Assets\scripts\TargetFollower.cs" /> <Compile Include="Assets\scripts\TargetFollower.cs" />
<Compile Include="Assets\scripts\TargetFollowerV2.cs" /> <Compile Include="Assets\scripts\TargetFollowerV2.cs" />
<Compile Include="Assets\scripts\TerafficGraphManager.cs" /> <Compile Include="Assets\scripts\TerafficGraphManager.cs" />
<Compile Include="Assets\scripts\Wall.cs" />
<Compile Include="Assets\scripts\Warning.cs" /> <Compile Include="Assets\scripts\Warning.cs" />
<Compile Include="Assets\scripts\menuSystem.cs" /> <Compile Include="Assets\scripts\menuSystem.cs" />
<None Include="Assets\RealisticEngineSound\Assets_For_NWH\ReadMe.txt" /> <None Include="Assets\RealisticEngineSound\Assets_For_NWH\ReadMe.txt" />
......
...@@ -121,6 +121,143 @@ NavMeshSettings: ...@@ -121,6 +121,143 @@ NavMeshSettings:
debug: debug:
m_Flags: 0 m_Flags: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
--- !u!1 &202245376
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 202245377}
m_Layer: 0
m_Name: testPos
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &202245377
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 202245376}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -76.22032, y: 0.7133479, z: 12.7}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 13
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &362651534
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 362651539}
- component: {fileID: 362651538}
- component: {fileID: 362651537}
- component: {fileID: 362651536}
- component: {fileID: 362651535}
m_Layer: 0
m_Name: bigWall
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &362651535
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 362651534}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 498ca4c8961158d47bf0a0bcbfd4d63e, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!64 &362651536
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 362651534}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 3
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &362651537
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 362651534}
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: 10303, guid: 0000000000000000f000000000000000, type: 0}
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 &362651538
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 362651534}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &362651539
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 362651534}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -70.82, y: 1.215, z: 15.897}
m_LocalScale: {x: 1, y: 1.6230241, z: 7.11823}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &373719878 --- !u!1 &373719878
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -26,7 +26,7 @@ Transform: ...@@ -26,7 +26,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1120560564} m_GameObject: {fileID: 1120560564}
m_LocalRotation: {x: 0.01492729, y: 0.24651483, z: -0.058015823, w: 0.9672858} m_LocalRotation: {x: 0.01492729, y: 0.24651483, z: -0.058015823, w: 0.9672858}
m_LocalPosition: {x: 0.019998867, y: 0.7900001, z: 2.19} m_LocalPosition: {x: -0.0159, y: 0.0098, z: -0.0538}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 1858462253} m_Father: {fileID: 1858462253}
...@@ -55,7 +55,7 @@ Camera: ...@@ -55,7 +55,7 @@ Camera:
y: 0 y: 0
width: 0.666 width: 0.666
height: 1 height: 1
near clip plane: 0.3 near clip plane: 0.01
far clip plane: 1000 far clip plane: 1000
field of view: 60 field of view: 60
orthographic: 0 orthographic: 0
...@@ -108,13 +108,13 @@ Transform: ...@@ -108,13 +108,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1313670780} m_GameObject: {fileID: 1313670780}
m_LocalRotation: {x: -0.012618587, y: -0.20838678, z: 0.049042564, w: 0.9767347} m_LocalRotation: {x: -0.02502238, y: -0.41322806, z: 0.097250715, w: 0.90507394}
m_LocalPosition: {x: 0.02, y: 0.79, z: 2.19} m_LocalPosition: {x: -0.189, y: 0.145, z: 0.167}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 1858462253} m_Father: {fileID: 1858462253}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: -0.24100001, y: -24.099, z: 5.8} m_LocalEulerAnglesHint: {x: 2.01, y: -48.88, z: 11.352}
--- !u!20 &1313670783 --- !u!20 &1313670783
Camera: Camera:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -138,9 +138,9 @@ Camera: ...@@ -138,9 +138,9 @@ Camera:
y: 0 y: 0
width: 0.33 width: 0.33
height: 1 height: 1
near clip plane: 0.3 near clip plane: 0.01
far clip plane: 1000 far clip plane: 1000
field of view: 60 field of view: 89.3
orthographic: 0 orthographic: 0
orthographic size: 5 orthographic size: 5
m_Depth: 0 m_Depth: 0
...@@ -190,7 +190,7 @@ Transform: ...@@ -190,7 +190,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1858462252} m_GameObject: {fileID: 1858462252}
m_LocalRotation: {x: 0.11526184, y: 0.0033910666, z: 0.029237071, w: 0.992899} m_LocalRotation: {x: 0.11526184, y: 0.0033910666, z: 0.029237071, w: 0.992899}
m_LocalPosition: {x: -0.08941364, y: 1.5174046, z: -6.45874} m_LocalPosition: {x: -0.4595, y: 1.1601, z: 0.0346}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 1313670781} - {fileID: 1313670781}
...@@ -225,7 +225,7 @@ Transform: ...@@ -225,7 +225,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1861719387} m_GameObject: {fileID: 1861719387}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.019998867, y: 0.7900001, z: 2.19} m_LocalPosition: {x: 0.0012, y: 0.0193, z: -0.0045}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 1858462253} m_Father: {fileID: 1858462253}
...@@ -254,7 +254,7 @@ Camera: ...@@ -254,7 +254,7 @@ Camera:
y: 0 y: 0
width: 0.333 width: 0.333
height: 1 height: 1
near clip plane: 0.3 near clip plane: 0.01
far clip plane: 1000 far clip plane: 1000
field of view: 60 field of view: 60
orthographic: 0 orthographic: 0
......
...@@ -17,9 +17,15 @@ public class DataSaver : MonoBehaviour ...@@ -17,9 +17,15 @@ public class DataSaver : MonoBehaviour
//set this //set this
public static Vector3 pivotPos; public static Vector3 pivotPos;
public static String pivotName = "startPoint"; public static String pivotName = "startPoint";
//delegates
public static Func<Vector3, Vector3> sideDistance;
// Start is called before the first frame update // Start is called before the first frame update
private string path; private string path;
private Vector3 firstPos;
private GameObject[] players; private GameObject[] players;
private IKD_VehicleController myPlayer; private IKD_VehicleController myPlayer;
private float timePassed = 0; private float timePassed = 0;
...@@ -35,6 +41,7 @@ public class DataSaver : MonoBehaviour ...@@ -35,6 +41,7 @@ public class DataSaver : MonoBehaviour
//OnCheckPoint += setNewChanges; //OnCheckPoint += setNewChanges;
pivotPos = pivot.transform.position; pivotPos = pivot.transform.position;
firstPos = pivot.transform.position;
StartCoroutine(find()); StartCoroutine(find());
...@@ -88,14 +95,33 @@ public class DataSaver : MonoBehaviour ...@@ -88,14 +95,33 @@ public class DataSaver : MonoBehaviour
// You can add up the values in as many cells as you want. // You can add up the values in as many cells as you want.
if (timePassed > 0.1) if (timePassed > 0.1)
{ {
string[] rowDataTemp = new string[4]; string[] rowDataTemp = new string[12];
rowDataTemp[0] = ""+ pivotName; rowDataTemp[0] = "" + (myPlayer.transform.position.x - firstPos.x);// distance to first pivot
rowDataTemp[1] = "" + myPlayer.speed; rowDataTemp[1] = "" + (myPlayer.transform.position.y - firstPos.y);
rowDataTemp[2] = "" + (myPlayer.transform.position.x - pivotPos.x); rowDataTemp[2] = "" + (myPlayer.transform.position.z - firstPos.z);
rowDataTemp[3] = "" + (myPlayer.transform.position.y - pivotPos.y); rowDataTemp[3] = ""+ myPlayer.speed; //current speed
rowDataTemp[4] = ""+(myPlayer.transform.position.z - pivotPos.z); rowDataTemp[4] = "" + pivotName; // last pivot name
rowDataTemp[5] = "" + (myPlayer.transform.position.x - pivotPos.x);// local distance to last pivot
rowDataTemp[6] = "" + (myPlayer.transform.position.y - pivotPos.y);
rowDataTemp[7] = ""+(myPlayer.transform.position.z - pivotPos.z);
if (sideDistance != null)
{
Vector3 hitPoint = sideDistance(myPlayer.transform.position);
rowDataTemp[8] = "" + Vector3.Distance(myPlayer.transform.position, hitPoint);
rowDataTemp[9] = "" + hitPoint.x;
rowDataTemp[10] = "" + hitPoint.y;
rowDataTemp[11] = "" + hitPoint.z;
}
else
{
rowDataTemp[8] = "None";
rowDataTemp[9] = "None";
rowDataTemp[10] = "None";
rowDataTemp[11] = "None";
}
rowData.Add(rowDataTemp); rowData.Add(rowDataTemp);
string newLine = string.Format("{0},{1},{2},{3},{4}", rowDataTemp[0], rowDataTemp[1], rowDataTemp[2], rowDataTemp[3],rowDataTemp[4]); string newLine = string.Format("{0},{1},{2},{3},{4},{5},{6},{7}", rowDataTemp[0], rowDataTemp[1], rowDataTemp[2], rowDataTemp[3],rowDataTemp[4],
rowDataTemp[5], rowDataTemp[6], rowDataTemp[7], rowDataTemp[8], rowDataTemp[9], rowDataTemp[10], rowDataTemp[11]);
timePassed = 0; timePassed = 0;
csv.AppendLine(newLine); csv.AppendLine(newLine);
} }
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(MeshCollider))]
public class Wall : MonoBehaviour
{
// Start is called before the first frame update
private MeshCollider coll;
void Start()
{
coll = this.GetComponent<MeshCollider>();
DataSaver.sideDistance = distanceToCar;
}
public Vector3 distanceToCar(Vector3 car)
{
Vector3 closestPoint = coll.ClosestPointOnBounds(car);
Debug.Log(closestPoint);
return closestPoint;
}
}
fileFormatVersion: 2
guid: 498ca4c8961158d47bf0a0bcbfd4d63e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
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