game: rework car ai scripts and rename

This commit is contained in:
Sc0rch-thinks 2024-08-07 14:55:21 +08:00 committed by Mark Joshwel
parent e7360dbd37
commit f93aa56b0e
11 changed files with 1277 additions and 1049 deletions

View file

@ -0,0 +1,935 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &415329803703564716
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7087102201065355644}
- component: {fileID: 314019511900797291}
- component: {fileID: 2452183237891392204}
m_Layer: 0
m_Name: FrontR
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7087102201065355644
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 415329803703564716}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.82043874, y: -0.23072667, z: 0.9910559}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 17060039056691794}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &314019511900797291
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 415329803703564716}
m_Mesh: {fileID: -6689342680031020648, guid: ea8f4c36c1c70304680c14a8eaa0a194, type: 3}
--- !u!23 &2452183237891392204
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 415329803703564716}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
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
m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &717729526835082114
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6274071953504936582}
- component: {fileID: 7290691945415941878}
m_Layer: 0
m_Name: BackL
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6274071953504936582
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 717729526835082114}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.7592659, y: -0.23072661, z: -0.9910543}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7588930987559127220}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!146 &7290691945415941878
WheelCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 717729526835082114}
serializedVersion: 2
m_Center: {x: -0.05, y: 0.15, z: 0}
m_Radius: 0.32
m_SuspensionSpring:
spring: 3500
damper: 450
targetPosition: 0.5
m_SuspensionDistance: 0.3
m_ForceAppPointDistance: 0
m_Mass: 20
m_WheelDampingRate: 0.25
m_ForwardFriction:
m_ExtremumSlip: 0.4
m_ExtremumValue: 1
m_AsymptoteSlip: 0.8
m_AsymptoteValue: 0.5
m_Stiffness: 1
m_SidewaysFriction:
m_ExtremumSlip: 0.2
m_ExtremumValue: 1
m_AsymptoteSlip: 0.5
m_AsymptoteValue: 0.75
m_Stiffness: 1
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_Enabled: 1
m_ProvidesContacts: 0
--- !u!1 &2356915431880259725
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7588930987559127220}
m_Layer: 0
m_Name: WheelCollider
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7588930987559127220
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2356915431880259725}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5177103297044667235}
- {fileID: 199143409442831854}
- {fileID: 2796278969311106577}
- {fileID: 6274071953504936582}
m_Father: {fileID: 6361272400870919845}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2584673759405809359
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2796278969311106577}
- component: {fileID: 1584769472662143334}
m_Layer: 0
m_Name: BackR
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2796278969311106577
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2584673759405809359}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.7592659, y: -0.23072661, z: -0.9910543}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7588930987559127220}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!146 &1584769472662143334
WheelCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2584673759405809359}
serializedVersion: 2
m_Center: {x: 0.05, y: 0.15, z: 0}
m_Radius: 0.32
m_SuspensionSpring:
spring: 3500
damper: 450
targetPosition: 0.5
m_SuspensionDistance: 0.3
m_ForceAppPointDistance: 0
m_Mass: 20
m_WheelDampingRate: 0.25
m_ForwardFriction:
m_ExtremumSlip: 0.4
m_ExtremumValue: 1
m_AsymptoteSlip: 0.8
m_AsymptoteValue: 0.5
m_Stiffness: 1
m_SidewaysFriction:
m_ExtremumSlip: 0.2
m_ExtremumValue: 1
m_AsymptoteSlip: 0.5
m_AsymptoteValue: 0.75
m_Stiffness: 1
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_Enabled: 1
m_ProvidesContacts: 0
--- !u!1 &4345058991812417362
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 17060039056691794}
m_Layer: 0
m_Name: WheelModel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &17060039056691794
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4345058991812417362}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7087102201065355644}
- {fileID: 8021931161623218599}
- {fileID: 7356397613521126891}
- {fileID: 7952176722598178378}
m_Father: {fileID: 6361272400870919845}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4485091964650148058
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2609033126121867358}
m_Layer: 0
m_Name: Target
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2609033126121867358
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4485091964650148058}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 151.85318, y: 76.588165, z: 323.46393}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 3786090014034998603}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &6511858023955813511
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7952176722598178378}
- component: {fileID: 7586443977144048344}
- component: {fileID: 1048701600050395497}
m_Layer: 0
m_Name: BackL
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7952176722598178378
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6511858023955813511}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.8204231, y: -0.23072667, z: -0.9910543}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 17060039056691794}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &7586443977144048344
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6511858023955813511}
m_Mesh: {fileID: 8926006964169710815, guid: ea8f4c36c1c70304680c14a8eaa0a194, type: 3}
--- !u!23 &1048701600050395497
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6511858023955813511}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
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
m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &6787610969218585514
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6361272400870919845}
- component: {fileID: 4617927937768008597}
- component: {fileID: 9159842949457787009}
- component: {fileID: 4705280546741671685}
- component: {fileID: 5251725214986322415}
m_Layer: 0
m_Name: CarModel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6361272400870919845
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6787610969218585514}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 17060039056691794}
- {fileID: 7588930987559127220}
m_Father: {fileID: 3786090014034998603}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &4617927937768008597
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6787610969218585514}
m_Mesh: {fileID: 7289310808242944780, guid: ea8f4c36c1c70304680c14a8eaa0a194, type: 3}
--- !u!23 &9159842949457787009
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6787610969218585514}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
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
m_AdditionalVertexStreams: {fileID: 0}
--- !u!54 &4705280546741671685
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6787610969218585514}
serializedVersion: 4
m_Mass: 100
m_Drag: 0
m_AngularDrag: 1.02
m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1}
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_ImplicitCom: 0
m_ImplicitTensor: 1
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!65 &5251725214986322415
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6787610969218585514}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1.5185318, y: 1.1346006, z: 3.2737274}
m_Center: {x: -0.000000029802322, y: 0.33657366, z: -0.019544065}
--- !u!1 &7593678884185826874
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 199143409442831854}
- component: {fileID: 5439388082056716231}
m_Layer: 0
m_Name: FrontL
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &199143409442831854
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7593678884185826874}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.7592659, y: -0.23072661, z: 0.9910559}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7588930987559127220}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!146 &5439388082056716231
WheelCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7593678884185826874}
serializedVersion: 2
m_Center: {x: -0.05, y: 0.15, z: 0}
m_Radius: 0.32
m_SuspensionSpring:
spring: 3500
damper: 450
targetPosition: 0.5
m_SuspensionDistance: 0.3
m_ForceAppPointDistance: 0
m_Mass: 20
m_WheelDampingRate: 0.25
m_ForwardFriction:
m_ExtremumSlip: 0.4
m_ExtremumValue: 1
m_AsymptoteSlip: 0.8
m_AsymptoteValue: 0.5
m_Stiffness: 1
m_SidewaysFriction:
m_ExtremumSlip: 0.2
m_ExtremumValue: 1
m_AsymptoteSlip: 0.5
m_AsymptoteValue: 0.75
m_Stiffness: 1
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_Enabled: 1
m_ProvidesContacts: 0
--- !u!1 &7827465232241196058
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7356397613521126891}
- component: {fileID: 4453462666644377404}
- component: {fileID: 8565895653740537244}
m_Layer: 0
m_Name: BackR
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7356397613521126891
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7827465232241196058}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.8204231, y: -0.23072667, z: -0.9910543}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 17060039056691794}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &4453462666644377404
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7827465232241196058}
m_Mesh: {fileID: -4127900863617580785, guid: ea8f4c36c1c70304680c14a8eaa0a194, type: 3}
--- !u!23 &8565895653740537244
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7827465232241196058}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
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
m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &8161675202289113455
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5177103297044667235}
- component: {fileID: 4039316318717688645}
m_Layer: 0
m_Name: FrontR
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5177103297044667235
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8161675202289113455}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.7592659, y: -0.23072661, z: 0.9910559}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7588930987559127220}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!146 &4039316318717688645
WheelCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8161675202289113455}
serializedVersion: 2
m_Center: {x: 0.05, y: 0.15, z: 0}
m_Radius: 0.32
m_SuspensionSpring:
spring: 3500
damper: 450
targetPosition: 0.5
m_SuspensionDistance: 0.3
m_ForceAppPointDistance: 0
m_Mass: 20
m_WheelDampingRate: 0.25
m_ForwardFriction:
m_ExtremumSlip: 0.4
m_ExtremumValue: 1
m_AsymptoteSlip: 0.8
m_AsymptoteValue: 0.5
m_Stiffness: 1
m_SidewaysFriction:
m_ExtremumSlip: 0.2
m_ExtremumValue: 1
m_AsymptoteSlip: 0.5
m_AsymptoteValue: 0.75
m_Stiffness: 1
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_Enabled: 1
m_ProvidesContacts: 0
--- !u!1 &8347088070876745341
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3786090014034998603}
- component: {fileID: 2568507803466170258}
- component: {fileID: 9161522608157501703}
m_Layer: 0
m_Name: AICar
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3786090014034998603
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8347088070876745341}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 499.134, y: 0.665, z: 508.959}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2609033126121867358}
- {fileID: 6361272400870919845}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2568507803466170258
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8347088070876745341}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6da9430305b32f446a2517f4a73fdf57, type: 3}
m_Name:
m_EditorClassIdentifier:
acceleration: 60
turnAngle: 30
wheels:
- wheelModel: {fileID: 415329803703564716}
wheelCollider: {fileID: 4039316318717688645}
axel: 0
- wheelModel: {fileID: 8814814114417480891}
wheelCollider: {fileID: 5439388082056716231}
axel: 0
- wheelModel: {fileID: 7827465232241196058}
wheelCollider: {fileID: 1584769472662143334}
axel: 1
- wheelModel: {fileID: 6511858023955813511}
wheelCollider: {fileID: 7290691945415941878}
axel: 1
brakeForce: 100000
braking: 0
--- !u!114 &9161522608157501703
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8347088070876745341}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bc82a40176164f02897928bd573bc2ca, type: 3}
m_Name:
m_EditorClassIdentifier:
carPosition: {fileID: 6361272400870919845}
stoppingDistance: 2
slowingSpeed: 7
slowingDistance: 15
reverseDist: 15
--- !u!1 &8814814114417480891
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8021931161623218599}
- component: {fileID: 7723467617933772018}
- component: {fileID: 5364905030912179499}
m_Layer: 0
m_Name: FrontL
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8021931161623218599
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8814814114417480891}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.8204231, y: -0.23072667, z: 0.9910559}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 17060039056691794}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &7723467617933772018
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8814814114417480891}
m_Mesh: {fileID: 5236127733658580, guid: ea8f4c36c1c70304680c14a8eaa0a194, type: 3}
--- !u!23 &5364905030912179499
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8814814114417480891}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
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
m_AdditionalVertexStreams: {fileID: 0}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a270ba76a3b8cc0458007401cf8f08bf
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -809,7 +809,7 @@ GameObject:
- component: {fileID: 3313027092289172340}
- component: {fileID: 4317789146800536370}
m_Layer: 0
m_Name: AI person
m_Name: AIPerson
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -865,12 +865,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f6822f90b5efff04997e5b884d402be8, type: 3}
m_Name:
m_EditorClassIdentifier:
entityType: 0
walkableLayers:
serializedVersion: 2
m_Bits: 4294967295
walkPoint: {x: 0, y: 0, z: 0}
strollRange: 30
destinationCoord: {x: 0, y: 0, z: 0}
movingRange: 149
--- !u!195 &4317789146800536370
NavMeshAgent:
m_ObjectHideFlags: 0

BIN
RunningLateGame/Assets/Prefabs/car.fbx (Stored with Git LFS)

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -129,4 +129,4 @@ private IEnumerator Strolling()
ChangeState();
}
}
}

View file

@ -0,0 +1,152 @@
using System.Collections;
using UnityEngine;
public class AICar : MonoBehaviour
{
[SerializeField] private Transform carPosition;
[SerializeField] private float stoppingDistance;
[SerializeField] private float slowingSpeed;
[SerializeField] private float slowingDistance;
[SerializeField] private float reverseDist;
private string _currentState;
private string _nextState;
private float _accelerationInput;
private CarController _car;
private float _angularDirection;
private Vector3 _dirToMove;
private float _distanceToTarget;
private Transform _driveTarget;
private float _turnInput;
private float _verticalDirection;
private void Awake()
{
var hasChild = false;
var i = 0;
GameObject test;
while (!hasChild)
{
test = gameObject.transform.GetChild(i).gameObject;
if (test.name == "Target")
{
_driveTarget = test.transform;
hasChild = true;
}
else
{
i++;
}
}
_car = GetComponent<CarController>();
_currentState = "Stopped";
_nextState = _currentState;
ChangeState();
}
private void Update()
{
_currentState = _nextState;
Debug.Log(_currentState);
}
private void ChangeState()
{
StartCoroutine(_currentState);
}
private void Steering()
{
_angularDirection = Vector3.SignedAngle(carPosition.transform.forward,
(_driveTarget.position - carPosition.transform.position).normalized, Vector3.up);
if (_angularDirection < 0)
_turnInput = -1;
else
_turnInput = 1;
}
private IEnumerator Stopped()
{
while (_currentState == "Stopped")
{
_distanceToTarget=Vector3.Distance(carPosition.position, _driveTarget.position);
_car.braking = true;
_accelerationInput = 0f;
_turnInput = 0f;
if (_distanceToTarget>stoppingDistance)
{
_nextState = "Slowed";
}
yield return new WaitForSeconds(1);
}
ChangeState();
}
private IEnumerator Slowed()
{
_car.braking = false;
while (_currentState == "Slowed")
{
_verticalDirection = Vector3.Dot(carPosition.transform.forward,
(_driveTarget.position - carPosition.transform.position).normalized);
_distanceToTarget = Vector3.Distance(carPosition.position, _driveTarget.position);
if (_verticalDirection>0)
{
if (carPosition.GetComponent<Rigidbody>().velocity.magnitude > slowingSpeed)
_accelerationInput = -1;
else
_accelerationInput = 1;
}
else
{
if (_distanceToTarget < reverseDist)
_accelerationInput = -1;
else
_accelerationInput = 1;
}
Steering();
SlowedCheck();
_car.SetInputs(_accelerationInput, _turnInput);
yield return new WaitForEndOfFrame();
}
ChangeState();
}
private IEnumerator Driving()
{
_car.braking = false;
while (_currentState == "Driving")
{
_verticalDirection = Vector3.Dot(carPosition.transform.forward,
(_driveTarget.position - carPosition.transform.position).normalized);
_distanceToTarget = Vector3.Distance(carPosition.position, _driveTarget.position);
_accelerationInput = 1;
Steering();
if (_distanceToTarget < slowingDistance) _nextState = "Slowed";
_car.SetInputs(_accelerationInput, _turnInput);
yield return new WaitForEndOfFrame();
}
ChangeState();
}
private void SlowedCheck()
{
if (_distanceToTarget < stoppingDistance)
{
_nextState = "Stopped";
}
if (_distanceToTarget > slowingDistance) _nextState = "Driving";
}
}

View file

@ -1,114 +0,0 @@
using System;
using UnityEngine;
public class AICar : MonoBehaviour
{
[SerializeField] private Transform carPosition;
[SerializeField] private float stoppingDistance;
[SerializeField] private float slowingSpeed;
[SerializeField] private float slowingDistance;
[SerializeField] private float reverseDist;
private CarController _car;
private string _currentState;
private Transform _driveTarget;
private string _nextState;
private void Awake()
{
var hasChild = false;
var i = 0;
GameObject test;
while (!hasChild)
{
test = gameObject.transform.GetChild(i).gameObject;
if (test.name == "Target")
{
_driveTarget = test.transform;
hasChild = true;
}
else
{
i++;
}
}
_car = GetComponent<CarController>();
_currentState = "Driving";
_nextState = _currentState;
ChangeState();
}
private void Update()
{
_currentState = _nextState;
}
private void ChangeState()
{
StartCoroutine(_currentState);
}
private IEnumerator Driving()
{
_car = GetComponent<CarController>();
while (_currentState == "Driving")
{
var accelerationAmount = 0f;
var turnAmount = 0f;
var targetPosition = _driveTarget.position;
var dirToMove = (targetPosition - carPosition.transform.position).normalized;
var forwardsAmount = Vector3.Dot(carPosition.transform.forward, dirToMove);
var directionToDrive = Vector3.SignedAngle(carPosition.transform.forward, dirToMove, Vector3.up);
var distanceToTarget = Vector3.Distance(carPosition.position, targetPosition);
if (distanceToTarget >= stoppingDistance)
{
_car.braking = false;
//in front of target position
if (forwardsAmount > 0)
{
//closer than the slowing distance
if (distanceToTarget <= slowingDistance)
{
//the car is very fast
if (carPosition.GetComponent<Rigidbody>().velocity.magnitude > slowingSpeed)
accelerationAmount = -2;
else
accelerationAmount = 1;
}
else
{
accelerationAmount = 1;
}
}
else
{
if (distanceToTarget < reverseDist)
accelerationAmount = -1;
else
accelerationAmount = 1;
}
if (directionToDrive < 0)
turnAmount = 1;
else if (directionToDrive > 0)
turnAmount = -1;
else
turnAmount = 0;
}
else
{
_car.braking = true;
accelerationAmount = 0f;
turnAmount = 0f;
}
Debug.Log(carPosition.GetComponent<Rigidbody>().velocity.magnitude);
_car.SetInputs(accelerationAmount, turnAmount);
yield return new WaitForEndOfFrame();
}
}
}

View file

@ -69,7 +69,7 @@ NavMeshProjectSettings:
cost: 1
- name:
cost: 1
m_LastAgentTypeID: -1372625422
m_LastAgentTypeID: -902729914
m_Settings:
- serializedVersion: 3
agentTypeID: 0
@ -89,5 +89,24 @@ NavMeshProjectSettings:
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
- serializedVersion: 3
agentTypeID: -902729914
agentRadius: 1.88
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_SettingNames:
- Humanoid
- car