car
This commit is contained in:
8
Assets/Car/Scripts/Wheel/Scripts.meta
Normal file
8
Assets/Car/Scripts/Wheel/Scripts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59f3eacb95253684196cdabaa94f41f6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
33
Assets/Car/Scripts/Wheel/Scripts/WheelControll.cs
Normal file
33
Assets/Car/Scripts/Wheel/Scripts/WheelControll.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class WheelControl : MonoBehaviour
|
||||
{
|
||||
public Transform wheelModel;
|
||||
|
||||
[HideInInspector] public WheelCollider WheelCollider;
|
||||
|
||||
// Create properties for the CarControl script
|
||||
// (You should enable/disable these via the
|
||||
// Editor Inspector window)
|
||||
public bool steerable;
|
||||
public bool motorized;
|
||||
|
||||
Vector3 position;
|
||||
Quaternion rotation;
|
||||
|
||||
// Start is called before the first frame update
|
||||
private void Start()
|
||||
{
|
||||
WheelCollider = GetComponent<WheelCollider>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
// Get the Wheel collider's world pose values and
|
||||
// use them to set the wheel model's position and rotation
|
||||
WheelCollider.GetWorldPose(out position, out rotation);
|
||||
wheelModel.transform.position = position;
|
||||
wheelModel.transform.rotation = rotation;
|
||||
}
|
||||
}
|
||||
2
Assets/Car/Scripts/Wheel/Scripts/WheelControll.cs.meta
Normal file
2
Assets/Car/Scripts/Wheel/Scripts/WheelControll.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 484c6bad1888141449bbccb931f4b3cf
|
||||
Reference in New Issue
Block a user