Car go wroom again
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f13d68cd0a1666f46834f4ef6d9d2f37
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user