Commit a5b626ae authored by Danial KordModanlou's avatar Danial KordModanlou

new distance system

parent 936a9011
......@@ -95,6 +95,7 @@
<e p="TargetFollowerV2.cs" t="Include" />
<e p="TerafficGraphManager.cs" t="Include" />
<e p="Wall.cs" t="Include" />
<e p="WallSphere.cs" t="Include" />
<e p="Warning.cs" t="Include" />
</e>
<e p="Standard Assets" t="Include">
......
......@@ -126,6 +126,7 @@
<Compile Include="Assets\scripts\TargetFollowerV2.cs" />
<Compile Include="Assets\scripts\TerafficGraphManager.cs" />
<Compile Include="Assets\scripts\Wall.cs" />
<Compile Include="Assets\scripts\WallSphere.cs" />
<Compile Include="Assets\scripts\Warning.cs" />
<Compile Include="Assets\scripts\menuSystem.cs" />
<None Include="Assets\RealisticEngineSound\Assets_For_NWH\ReadMe.txt" />
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -134,7 +134,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 125301449}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 498ca4c8961158d47bf0a0bcbfd4d63e, type: 3}
m_Name:
......@@ -153,6 +153,90 @@ MeshCollider:
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: -4058646288771621125, guid: 1e88c95a7a1f988488ee8076c968fcb5, type: 3}
--- !u!1001 &168629609
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 6517492368474291616, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_Name
value: final orginal (7)
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291616, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_LocalPosition.x
value: -668.79816
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_LocalPosition.y
value: 701.68475
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_LocalPosition.z
value: 119.57807
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6517492369421744767, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6517492369421744767, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 93ab9d7bcd8b80744ab77a800f1db95b, type: 3}
--- !u!1 &202245376
GameObject:
m_ObjectHideFlags: 0
......@@ -181,7 +265,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 15
m_RootOrder: 16
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &281076911
PrefabInstance:
......@@ -270,6 +354,11 @@ PrefabInstance:
propertyPath: m_Name
value: rah-shane3
objectReference: {fileID: 0}
- target: {fileID: 5903998474558691662, guid: 1e88c95a7a1f988488ee8076c968fcb5,
type: 3}
propertyPath: m_Layer
value: 8
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1e88c95a7a1f988488ee8076c968fcb5, type: 3}
--- !u!1 &354712830
......@@ -505,7 +594,7 @@ Transform:
m_LocalScale: {x: 1, y: 1.6230241, z: 7.11823}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 14
m_RootOrder: 15
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &373719878
GameObject:
......@@ -598,7 +687,7 @@ Transform:
m_LocalScale: {x: 1000.0001, y: 1, z: 999.9999}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 12
m_RootOrder: 13
m_LocalEulerAnglesHint: {x: 0.611, y: 0.0050000004, z: 0.84700006}
--- !u!224 &378007929 stripped
RectTransform:
......@@ -789,7 +878,7 @@ PrefabInstance:
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_RootOrder
value: 7
value: 8
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
......@@ -908,7 +997,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &709509107
GameObject:
......@@ -952,7 +1041,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 16
m_RootOrder: 17
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &781198528
PrefabInstance:
......@@ -1009,7 +1098,7 @@ PrefabInstance:
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_RootOrder
value: 1
value: 2
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
......@@ -1103,7 +1192,7 @@ PrefabInstance:
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_RootOrder
value: 4
value: 5
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
......@@ -1286,7 +1375,7 @@ Transform:
m_Children:
- {fileID: 1491121497}
m_Father: {fileID: 0}
m_RootOrder: 17
m_RootOrder: 18
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1195730325
GameObject:
......@@ -1475,7 +1564,7 @@ PrefabInstance:
- target: {fileID: 3385489612561274353, guid: 8a33eea58df35424f9723773bb025809,
type: 3}
propertyPath: m_RootOrder
value: 5
value: 6
objectReference: {fileID: 0}
- target: {fileID: 3385489612561274353, guid: 8a33eea58df35424f9723773bb025809,
type: 3}
......@@ -1554,7 +1643,7 @@ PrefabInstance:
- target: {fileID: 8768170946503470804, guid: 56244b3d420d5a3459e68449d1f30fbf,
type: 3}
propertyPath: m_RootOrder
value: 6
value: 7
objectReference: {fileID: 0}
- target: {fileID: 8768170946503470804, guid: 56244b3d420d5a3459e68449d1f30fbf,
type: 3}
......@@ -1780,7 +1869,7 @@ PrefabInstance:
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_RootOrder
value: 3
value: 4
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
......@@ -2356,7 +2445,7 @@ PrefabInstance:
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_RootOrder
value: 2
value: 3
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
......@@ -2506,7 +2595,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 11
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1971670298
GameObject:
......@@ -2713,7 +2802,7 @@ Transform:
- {fileID: 1614892422}
- {fileID: 1389580375}
m_Father: {fileID: 0}
m_RootOrder: 13
m_RootOrder: 14
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &2047104779
PrefabInstance:
......@@ -3055,7 +3144,7 @@ PrefabInstance:
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
propertyPath: m_RootOrder
value: 8
value: 9
objectReference: {fileID: 0}
- target: {fileID: 6517492368474291627, guid: 93ab9d7bcd8b80744ab77a800f1db95b,
type: 3}
......@@ -3199,7 +3288,7 @@ PrefabInstance:
- target: {fileID: 8768170946503470804, guid: 56244b3d420d5a3459e68449d1f30fbf,
type: 3}
propertyPath: m_RootOrder
value: 9
value: 10
objectReference: {fileID: 0}
- target: {fileID: 8768170946503470804, guid: 56244b3d420d5a3459e68449d1f30fbf,
type: 3}
......
......@@ -3734,6 +3734,7 @@ GameObject:
- component: {fileID: 6517492368474291618}
- component: {fileID: 6517492368474291617}
- component: {fileID: 4444491943193057865}
- component: {fileID: 168629611}
m_Layer: 0
m_Name: final orginal
m_TagString: Player
......@@ -4254,6 +4255,22 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2424e0f15872e044d82c5a252d3e20e3, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &168629611
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6517492368474291616}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3ac933ff484ed6842a06a1b5194538b8, type: 3}
m_Name:
m_EditorClassIdentifier:
largeIterationNumbers: 15
iterationNumbers: 100
longestJump: 10
layer: 8
--- !u!1 &6517492368491616081
GameObject:
m_ObjectHideFlags: 0
......
fileFormatVersion: 2
guid: 1e88c95a7a1f988488ee8076c968fcb5
ModelImporter:
serializedVersion: 19300
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: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
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:
......@@ -20,7 +20,7 @@ public class DataSaver : MonoBehaviour
//delegates
public static Action<Vector3,Action<Vector3,float>> sideDistance;
public static Func<Vector3,float> sideDistance;
// Start is called before the first frame update
......@@ -61,12 +61,12 @@ public class DataSaver : MonoBehaviour
pName = menu.PlayerName;
//timePassed += Time.deltaTime;
timePassed += Time.deltaTime;
// if (timePassed > 0.1)
// {
if (timePassed > 0.25f)
{
Save();
// }
}
}
......@@ -101,8 +101,7 @@ public class DataSaver : MonoBehaviour
}
Vector3 playerPos = myPlayer.transform.position;
sideDistance(playerPos, (wallPos,distanceFloat) =>
{
float distanceFloat = sideDistance(playerPos);
// You can add up the values in as many cells as you want.
......@@ -119,9 +118,9 @@ public class DataSaver : MonoBehaviour
{
//distanceComponent hitPoint = sideDistance(myPlayer.transform.position);
rowDataTemp[8] = "" + distanceFloat;
rowDataTemp[9] = "" + wallPos.x;
rowDataTemp[10] = "" + wallPos.y;
rowDataTemp[11] = "" + wallPos.z;
rowDataTemp[9] = "____";
rowDataTemp[10] = "___";
rowDataTemp[11] = "___";
}
else
{
......@@ -184,7 +183,7 @@ public class DataSaver : MonoBehaviour
}
stable = true;
});
}
......
......@@ -21,7 +21,7 @@ public class Wall : MonoBehaviour
{
coll = this.GetComponent<MeshCollider>();
//DataSaver.sideDistance = distanceToCar;
DataSaver.sideDistance = newMethod;
// DataSaver.sideDistance = newMethod;
}
public Vector3 distanceToCar(Vector3 car)
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WallSphere : MonoBehaviour
{
public int largeIterationNumbers;
public int iterationNumbers;
public float longestJump;
public int layer;
// [SerializeField] private int layer;
private int layerMask;
// Start is called before the first frame update
void Start()
{
layerMask = 1 << layer;
// layerMask = ~layerMask;
DataSaver.sideDistance = test;
}
// Update is called once per frame
void Update()
{
// test(this.transform.position);
}
public float test(Vector3 carPos) // must change layer mask of wall
{
float firsDistancse =0 ;
for(int i = 0; i < largeIterationNumbers; i++) // set up the worst prediction of collision
{
firsDistancse += longestJump;
if( Physics.OverlapSphere(carPos, firsDistancse, layerMask) != null){
Debug.Log("find :"+ firsDistancse);
break;
}
}
float currentAddetiveDistance = longestJump;
float currentDistance = firsDistancse;
Collider[] hitColliders = Physics.OverlapSphere(carPos, firsDistancse ,layerMask);
for (int i=0;i< iterationNumbers; i++)
{
currentAddetiveDistance = currentAddetiveDistance/2;
if(hitColliders.Length !=0)
{
currentDistance -= currentAddetiveDistance;
// Debug.Log("true : "+ currentDistance + "name collider" +hitColliders[0].name + "--"+ hitColliders.Length);
}
else
{
currentDistance += currentAddetiveDistance;
//Debug.Log("false");
}
hitColliders = Physics.OverlapSphere(carPos, currentDistance, layerMask);
}
print(currentDistance);
return currentDistance;
}
}
fileFormatVersion: 2
guid: 3ac933ff484ed6842a06a1b5194538b8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -13,7 +13,7 @@ TagManager:
- UI
-
-
-
- wall
-
-
-
......
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