This commit is contained in:
DedMoroz132
2022-04-18 16:11:25 +07:00
parent 32007d789e
commit bbadfc5c26
1621 changed files with 647824 additions and 0 deletions

View File

@ -0,0 +1,29 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.Vehicles.Car
{
// this script is specific to the car supplied in the the assets
// it controls the suspension hub to make it move with the wheel are it goes over bumps
public class Suspension : MonoBehaviour
{
public GameObject wheel; // The wheel that the script needs to referencing to get the postion for the suspension
private Vector3 m_TargetOriginalPosition;
private Vector3 m_Origin;
private void Start()
{
m_TargetOriginalPosition = wheel.transform.localPosition;
m_Origin = transform.localPosition;
}
private void Update()
{
transform.localPosition = m_Origin + (wheel.transform.localPosition - m_TargetOriginalPosition);
}
}
}