crazy car physics

This commit is contained in:
2024-04-05 14:06:07 +02:00
parent ce41f0141b
commit b277104435
5 changed files with 4073 additions and 157 deletions

View File

@@ -11,6 +11,7 @@ GameObject:
- component: {fileID: 5420764024659664985}
- component: {fileID: 3239213433477781764}
- component: {fileID: 1857703685905104433}
- component: {fileID: 5418785709807611868}
m_Layer: 0
m_Name: Hotrod
m_TagString: Untagged
@@ -28,7 +29,7 @@ Transform:
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3.8524709, y: -2.92524, z: -4.392884}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalScale: {x: 0.125, y: 0.125, z: 0.125}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7953198523918571078}
@@ -43,8 +44,8 @@ Rigidbody:
m_GameObject: {fileID: 5711380006811689493}
serializedVersion: 4
m_Mass: 1500
m_Drag: 0.25
m_AngularDrag: 0.05
m_Drag: 0.1
m_AngularDrag: 0
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}
@@ -68,7 +69,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5711380006811689493}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a23c7d66d3ff94847a946cf7b30ca1b7, type: 3}
m_Name:
@@ -76,6 +77,24 @@ MonoBehaviour:
motorTorque: 2000
maxSpeed: 50
steeringRange: 30
--- !u!114 &5418785709807611868
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5711380006811689493}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 58d3a2623a4164b4bb25683edc176b03, type: 3}
m_Name:
m_EditorClassIdentifier:
motorTorque: 40
brakeTorque: 40
maxSpeed: 40
steeringRange: 10
steeringRangeAtMaxSpeed: 10
autoBrake: 20
--- !u!1001 &6613855157239500655
PrefabInstance:
m_ObjectHideFlags: 0
@@ -120,6 +139,14 @@ PrefabInstance:
propertyPath: m_SuspensionDistance
value: 0.25
objectReference: {fileID: 0}
- target: {fileID: 211855197576047450, guid: 0a84c5c2846d02440b5cea7fafee4fa5, type: 3}
propertyPath: m_ForwardFriction.m_Stiffness
value: 2
objectReference: {fileID: 0}
- target: {fileID: 211855197576047450, guid: 0a84c5c2846d02440b5cea7fafee4fa5, type: 3}
propertyPath: m_SidewaysFriction.m_Stiffness
value: 2
objectReference: {fileID: 0}
- target: {fileID: 211855197576047450, guid: 0a84c5c2846d02440b5cea7fafee4fa5, type: 3}
propertyPath: m_SuspensionSpring.targetPosition
value: 1
@@ -204,6 +231,14 @@ PrefabInstance:
propertyPath: m_SuspensionSpring.damper
value: 1500
objectReference: {fileID: 0}
- target: {fileID: 8344151628468935024, guid: 0a84c5c2846d02440b5cea7fafee4fa5, type: 3}
propertyPath: m_ForwardFriction.m_Stiffness
value: 2
objectReference: {fileID: 0}
- target: {fileID: 8344151628468935024, guid: 0a84c5c2846d02440b5cea7fafee4fa5, type: 3}
propertyPath: m_SidewaysFriction.m_Stiffness
value: 2
objectReference: {fileID: 0}
- target: {fileID: 8344151628468935024, guid: 0a84c5c2846d02440b5cea7fafee4fa5, type: 3}
propertyPath: m_SuspensionSpring.targetPosition
value: 1

View File

@@ -198,25 +198,9 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1857703685905104433, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2883785401448142367, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
propertyPath: m_ForwardFriction.m_Stiffness
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2883785401448142367, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
propertyPath: m_SidewaysFriction.m_Stiffness
value: 2
objectReference: {fileID: 0}
- target: {fileID: 3239213433477781764, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
propertyPath: m_Drag
value: 0.1
objectReference: {fileID: 0}
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
propertyPath: m_LocalPosition.x
value: 9
value: 1.61
objectReference: {fileID: 0}
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
propertyPath: m_LocalPosition.y
@@ -224,7 +208,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
propertyPath: m_LocalPosition.z
value: 70
value: 8.06
objectReference: {fileID: 0}
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
propertyPath: m_LocalRotation.w
@@ -258,21 +242,10 @@ PrefabInstance:
propertyPath: m_Name
value: Hotrod
objectReference: {fileID: 0}
- target: {fileID: 6429322875164058677, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
propertyPath: m_ForwardFriction.m_Stiffness
value: 2
objectReference: {fileID: 0}
- target: {fileID: 6429322875164058677, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
propertyPath: m_SidewaysFriction.m_Stiffness
value: 2
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 5711380006811689493, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
insertIndex: -1
addedObject: {fileID: 749736917}
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
--- !u!1001 &300876409
PrefabInstance:
@@ -683,29 +656,6 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 450060be716600a46927ba00fb04135b, type: 3}
--- !u!1 &749736913 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 5711380006811689493, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
m_PrefabInstance: {fileID: 293910239}
m_PrefabAsset: {fileID: 0}
--- !u!114 &749736917
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 749736913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 58d3a2623a4164b4bb25683edc176b03, type: 3}
m_Name:
m_EditorClassIdentifier:
motorTorque: 5000
brakeTorque: 20000
maxSpeed: 1000
steeringRange: 60
steeringRangeAtMaxSpeed: 35
autoBrake: 3000
--- !u!1001 &760601908
PrefabInstance:
m_ObjectHideFlags: 0
@@ -1018,98 +968,6 @@ Transform:
- {fileID: 1802081976}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1047804915
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1047804918}
- component: {fileID: 1047804917}
- component: {fileID: 1047804916}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1047804916
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1047804915}
m_Enabled: 1
--- !u!20 &1047804917
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1047804915}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1047804918
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1047804915}
serializedVersion: 2
m_LocalRotation: {x: 0.32650557, y: 0.6272114, z: -0.32650557, w: 0.6272114}
m_LocalPosition: {x: -27.1, y: 57.3, z: 30}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 55, y: 90, z: 0}
--- !u!1001 &1050407802
PrefabInstance:
m_ObjectHideFlags: 0
@@ -1192,6 +1050,81 @@ Transform:
m_CorrespondingSourceObject: {fileID: 2129857982551333138, guid: 450060be716600a46927ba00fb04135b, type: 3}
m_PrefabInstance: {fileID: 696631378}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1622030914
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1622030916}
- component: {fileID: 1622030915}
m_Layer: 0
m_Name: InputController
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1622030915
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1622030914}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 43a3b21977ed2c64b8d62ca5013ab914, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &1622030916
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1622030914}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -3.367576, y: 0.82818604, z: 3.8048892}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1682630364
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1682630365}
m_Layer: 0
m_Name: camerapoint
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1682630365
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1682630364}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 18.2, y: 0, z: 26.6}
m_LocalScale: {x: 20, y: 20, z: 20}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1802081976}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &1698210948 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 142139215064909979, guid: 4a3c4da6be9dcc545aa33ddf39ccde58, type: 3}
@@ -1223,7 +1156,7 @@ Transform:
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_LocalScale: {x: 0.125, y: 0.125, z: 0.125}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 937396212}
@@ -1242,6 +1175,7 @@ Transform:
- {fileID: 257377415}
- {fileID: 2116660885}
- {fileID: 1299801271}
- {fileID: 1682630365}
m_Father: {fileID: 977927543}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1848958940
@@ -1420,6 +1354,155 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 450060be716600a46927ba00fb04135b, type: 3}
--- !u!1001 &1905594395
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 320316327550477191, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalPosition.x
value: 2.7908077
objectReference: {fileID: 0}
- target: {fileID: 320316327550477191, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalPosition.y
value: 1.5794907
objectReference: {fileID: 0}
- target: {fileID: 320316327550477191, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalPosition.z
value: 10.266191
objectReference: {fileID: 0}
- target: {fileID: 320316327550477191, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.w
value: 0.6115838
objectReference: {fileID: 0}
- target: {fileID: 320316327550477191, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.x
value: 0.3549159
objectReference: {fileID: 0}
- target: {fileID: 320316327550477191, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.y
value: 0.6115838
objectReference: {fileID: 0}
- target: {fileID: 320316327550477191, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.z
value: -0.3549159
objectReference: {fileID: 0}
- target: {fileID: 679652745285801860, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: field of view
value: 60.000004
objectReference: {fileID: 0}
- target: {fileID: 1387890555408215438, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_Name
value: Camera
objectReference: {fileID: 0}
- target: {fileID: 2100622393876020061, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: Damping.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2100622393876020061, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: Damping.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2100622393876020061, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: CameraSide
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2100622393876020061, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: CameraDistance
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2100622393876020061, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: ShoulderOffset.x
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2100622393876020061, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: ShoulderOffset.y
value: 3
objectReference: {fileID: 0}
- target: {fileID: 6331817402021486753, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalPosition.x
value: -2.5158076
objectReference: {fileID: 0}
- target: {fileID: 6331817402021486753, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalPosition.y
value: 1.9205093
objectReference: {fileID: 0}
- target: {fileID: 6331817402021486753, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalPosition.z
value: -6.9411907
objectReference: {fileID: 0}
- target: {fileID: 6331817402021486753, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6331817402021486753, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6331817402021486753, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6331817402021486753, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6331817402021486753, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6331817402021486753, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6331817402021486753, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8858152487650577344, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_Follow
value:
objectReference: {fileID: 1682630365}
- target: {fileID: 8858152487650577344, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LookAt
value:
objectReference: {fileID: 1682630365}
- target: {fileID: 8890610309520933432, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalPosition.x
value: 2.7908077
objectReference: {fileID: 0}
- target: {fileID: 8890610309520933432, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalPosition.y
value: 1.5794907
objectReference: {fileID: 0}
- target: {fileID: 8890610309520933432, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalPosition.z
value: 10.266191
objectReference: {fileID: 0}
- target: {fileID: 8890610309520933432, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.w
value: 0.6115838
objectReference: {fileID: 0}
- target: {fileID: 8890610309520933432, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.x
value: 0.3549159
objectReference: {fileID: 0}
- target: {fileID: 8890610309520933432, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.y
value: 0.6115838
objectReference: {fileID: 0}
- target: {fileID: 8890610309520933432, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.z
value: -0.3549159
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
--- !u!1001 &2005853890
PrefabInstance:
m_ObjectHideFlags: 0
@@ -1491,7 +1574,8 @@ Transform:
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 1047804918}
- {fileID: 827083360}
- {fileID: 977927543}
- {fileID: 1622030916}
- {fileID: 293910239}
- {fileID: 1905594395}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9b5f77be9dfb7c14cba3af351597ec83
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -38,7 +38,7 @@ public class carcontrolv2 : MonoBehaviour
// Calculate how close the car is to top speed
// as a number from zero to one
float speedFactor = Mathf.InverseLerp(0, maxSpeed, forwardSpeed);
float speedFactor = Mathf.InverseLerp(0, maxSpeed / 4, forwardSpeed);
// Use that to calculate how much torque is available
// (zero torque at top speed)
@@ -46,6 +46,7 @@ public class carcontrolv2 : MonoBehaviour
// …and to calculate how much to steer
// (the car steers more gently at top speed)
float currentSteerRange = Mathf.Lerp(steeringRange, steeringRangeAtMaxSpeed, speedFactor);
// Check whether the user input is in the same direction
@@ -56,6 +57,11 @@ public class carcontrolv2 : MonoBehaviour
bool isBraking = (vInput < 0 && forwardSpeed > 0) || (vInput > 0 && forwardSpeed < 0);
if (vInput > 0 && forwardSpeed < 0)
{
isAccelerating = false;
}
foreach (var wheel in wheels)
{
// Apply steering to Wheel colliders that have "Steerable" enabled
@@ -63,6 +69,12 @@ public class carcontrolv2 : MonoBehaviour
{
wheel.WheelCollider.steerAngle = hInput * currentSteerRange;
}
if (isBraking)
{
wheel.WheelCollider.brakeTorque = Mathf.Abs(vInput) * brakeTorque;
//wheel.WheelCollider.motorTorque = 0;
}
if (isAccelerating)
{
@@ -74,11 +86,7 @@ public class carcontrolv2 : MonoBehaviour
wheel.WheelCollider.brakeTorque = 0;
}
if (isBraking)
{
wheel.WheelCollider.brakeTorque = Mathf.Abs(vInput) * brakeTorque;
//wheel.WheelCollider.motorTorque = 0;
}
if (isStopping)
{