This commit is contained in:
2026-06-09 09:18:17 +07:00
parent 3578a2750c
commit 71a096556a
5777 changed files with 6675 additions and 13 deletions

View File

@@ -1,32 +0,0 @@
namespace Opsive.UltimateCharacterController.Demo.UnityStandardAssets.Vehicles.Car
{
using UnityEngine;
// this script is specific to the supplied Sample Assets car, which has mudguards over the front wheels
// which have to turn with the wheels when steering is applied.
public class Mudguard : MonoBehaviour
{
public GameObject m_Wheel; // The wheel that the script needs to referencing to get the postion for the suspension
private CarController m_CarController; // car controller to get the steering angle
private Vector3 m_TargetOriginalPosition;
private Vector3 m_OriginalPosition;
private Quaternion m_OriginalRotation;
private void Start()
{
m_CarController = GetComponentInParent<CarController>();
m_TargetOriginalPosition = m_Wheel.transform.localPosition;
m_OriginalPosition = transform.localPosition;
m_OriginalRotation = transform.localRotation;
}
private void Update()
{
transform.localPosition = m_OriginalPosition + (m_Wheel.transform.localPosition - m_TargetOriginalPosition);
transform.localRotation = m_OriginalRotation * Quaternion.Euler(0, m_CarController.CurrentSteerAngle, 0);
}
}
}