Car go wroom again

This commit is contained in:
magn9775
2024-04-05 10:01:40 +02:00
parent 0b0779be7e
commit 28c12f07d9
6 changed files with 401 additions and 241 deletions

View File

@@ -1,25 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CarController : MonoBehaviour
{
public WheelCollider frontLeftWheel, frontRightWheel;
public WheelCollider rearLeftWheel, rearRightWheel;
public float motorForce = 1000f;
public float steeringAngle = 30f;
void Update()
{
// Motor input
float motorInput = Input.GetAxis("Vertical");
rearLeftWheel.motorTorque = motorInput * motorForce;
rearRightWheel.motorTorque = motorInput * motorForce;
// Steering input
float steeringInput = Input.GetAxis("Horizontal");
frontLeftWheel.steerAngle = steeringInput * steeringAngle;
frontRightWheel.steerAngle = steeringInput * steeringAngle;
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f13d68cd0a1666f46834f4ef6d9d2f37
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: