Merge branch 'master' of git@ooftooft.net:Racesm.git

This commit is contained in:
PokingPines
2024-03-22 12:57:47 +01:00
2 changed files with 270 additions and 10 deletions

View File

@@ -217,6 +217,50 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &781899710 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6042857785779139090, guid: 111b35f8de4ac224fac79cad29bd6c8f, type: 3}
m_PrefabInstance: {fileID: 1631552226}
m_PrefabAsset: {fileID: 0}
--- !u!146 &781899714
WheelCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 781899710}
serializedVersion: 2
m_Center: {x: 0, y: 0, z: 0}
m_Radius: 0.0035
m_SuspensionSpring:
spring: 35000
damper: 4500
targetPosition: 0.5
m_SuspensionDistance: 0
m_ForceAppPointDistance: 0
m_Mass: 80
m_WheelDampingRate: 0.0001
m_ForwardFriction:
m_ExtremumSlip: 2
m_ExtremumValue: 5
m_AsymptoteSlip: 5
m_AsymptoteValue: 2
m_Stiffness: 1
m_SidewaysFriction:
m_ExtremumSlip: 0.4
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 &963194225
GameObject:
m_ObjectHideFlags: 0
@@ -319,6 +363,7 @@ GameObject:
m_Component:
- component: {fileID: 975676258}
- component: {fileID: 975676257}
- component: {fileID: 975676259}
m_Layer: 0
m_Name: Car
m_TagString: Untagged
@@ -338,6 +383,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f13d68cd0a1666f46834f4ef6d9d2f37, type: 3}
m_Name:
m_EditorClassIdentifier:
frontLeftWheel: {fileID: 781899714}
frontRightWheel: {fileID: 2051030389}
rearLeftWheel: {fileID: 1587747397}
rearRightWheel: {fileID: 1392612351}
motorForce: 10000
steeringAngle: 30
--- !u!4 &975676258
Transform:
m_ObjectHideFlags: 0
@@ -347,13 +398,128 @@ Transform:
m_GameObject: {fileID: 975676256}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.54991174, z: -0.0102341175}
m_LocalPosition: {x: 0, y: 0.55, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1887155134}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!54 &975676259
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 975676256}
serializedVersion: 4
m_Mass: 1010
m_Drag: 0
m_AngularDrag: 0.05
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: 1
m_ImplicitTensor: 1
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!1 &1392612347 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 8123133972670517232, guid: 111b35f8de4ac224fac79cad29bd6c8f, type: 3}
m_PrefabInstance: {fileID: 1631552226}
m_PrefabAsset: {fileID: 0}
--- !u!146 &1392612351
WheelCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1392612347}
serializedVersion: 2
m_Center: {x: 0, y: 0, z: 0}
m_Radius: 0.0035
m_SuspensionSpring:
spring: 35000
damper: 4500
targetPosition: 0.5
m_SuspensionDistance: 0
m_ForceAppPointDistance: 0
m_Mass: 80
m_WheelDampingRate: 0.0001
m_ForwardFriction:
m_ExtremumSlip: 2
m_ExtremumValue: 5
m_AsymptoteSlip: 5
m_AsymptoteValue: 2
m_Stiffness: 1
m_SidewaysFriction:
m_ExtremumSlip: 0.4
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 &1587747393 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7133053663161983975, guid: 111b35f8de4ac224fac79cad29bd6c8f, type: 3}
m_PrefabInstance: {fileID: 1631552226}
m_PrefabAsset: {fileID: 0}
--- !u!146 &1587747397
WheelCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1587747393}
serializedVersion: 2
m_Center: {x: 0, y: 0, z: 0}
m_Radius: 0.0035
m_SuspensionSpring:
spring: 35000
damper: 4500
targetPosition: 0.5
m_SuspensionDistance: 0
m_ForceAppPointDistance: 0
m_Mass: 80
m_WheelDampingRate: 0.0001
m_ForwardFriction:
m_ExtremumSlip: 2
m_ExtremumValue: 5
m_AsymptoteSlip: 5
m_AsymptoteValue: 2
m_Stiffness: 1
m_SidewaysFriction:
m_ExtremumSlip: 0.4
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!1001 &1631552226
PrefabInstance:
m_ObjectHideFlags: 0
@@ -433,7 +599,22 @@ PrefabInstance:
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 1031664489681167981, guid: 111b35f8de4ac224fac79cad29bd6c8f, type: 3}
insertIndex: -1
addedObject: {fileID: 1901791201}
- targetCorrespondingSourceObject: {fileID: 6042857785779139090, guid: 111b35f8de4ac224fac79cad29bd6c8f, type: 3}
insertIndex: -1
addedObject: {fileID: 781899714}
- targetCorrespondingSourceObject: {fileID: 993290278178799080, guid: 111b35f8de4ac224fac79cad29bd6c8f, type: 3}
insertIndex: -1
addedObject: {fileID: 2051030389}
- targetCorrespondingSourceObject: {fileID: 7133053663161983975, guid: 111b35f8de4ac224fac79cad29bd6c8f, type: 3}
insertIndex: -1
addedObject: {fileID: 1587747397}
- targetCorrespondingSourceObject: {fileID: 8123133972670517232, guid: 111b35f8de4ac224fac79cad29bd6c8f, type: 3}
insertIndex: -1
addedObject: {fileID: 1392612351}
m_SourcePrefab: {fileID: 100100000, guid: 111b35f8de4ac224fac79cad29bd6c8f, type: 3}
--- !u!4 &1631552227 stripped
Transform:
@@ -472,6 +653,32 @@ Transform:
- {fileID: 1631552227}
m_Father: {fileID: 975676258}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1901791197 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1031664489681167981, guid: 111b35f8de4ac224fac79cad29bd6c8f, type: 3}
m_PrefabInstance: {fileID: 1631552226}
m_PrefabAsset: {fileID: 0}
--- !u!65 &1901791201
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1901791197}
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: 0.021657102, y: 0.047731277, z: 0.009883498}
m_Center: {x: 0, y: 0.00010234115, z: 0.006055903}
--- !u!1 &1915174277
GameObject:
m_ObjectHideFlags: 0
@@ -507,7 +714,7 @@ MeshCollider:
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_ProvidesContacts: 1
m_Enabled: 1
serializedVersion: 5
m_Convex: 0
@@ -578,6 +785,50 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2051030385 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 993290278178799080, guid: 111b35f8de4ac224fac79cad29bd6c8f, type: 3}
m_PrefabInstance: {fileID: 1631552226}
m_PrefabAsset: {fileID: 0}
--- !u!146 &2051030389
WheelCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2051030385}
serializedVersion: 2
m_Center: {x: 0, y: 0, z: 0}
m_Radius: 0.0035
m_SuspensionSpring:
spring: 35000
damper: 4500
targetPosition: 0.5
m_SuspensionDistance: 0
m_ForceAppPointDistance: 0
m_Mass: 80
m_WheelDampingRate: 0.0001
m_ForwardFriction:
m_ExtremumSlip: 2
m_ExtremumValue: 5
m_AsymptoteSlip: 5
m_AsymptoteValue: 2
m_Stiffness: 1
m_SidewaysFriction:
m_ExtremumSlip: 0.4
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!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0

View File

@@ -4,15 +4,24 @@ using UnityEngine;
public class CarController : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
public WheelCollider frontLeftWheel, frontRightWheel;
public WheelCollider rearLeftWheel, rearRightWheel;
public float motorForce = 10000000f;
public float steeringAngle = 30f;
// Update is called once per frame
void Update()
{
// Motor input
float motorInput = Input.GetAxis("Vertical");
frontLeftWheel.motorTorque = motorInput * motorForce;
frontRightWheel.motorTorque = motorInput * motorForce;
// Steering input
float steeringInput = Input.GetAxis("Horizontal");
frontLeftWheel.steerAngle = steeringInput * steeringAngle;
frontRightWheel.steerAngle = steeringInput * steeringAngle;
// Move camera
}
}