Добавил скрипты для более реалистичной физики, но они шляпа полная.
This commit is contained in:
1 parent
f9eb14868d
commit
5f25a8eab4
32 files changed
+490
-1643
No files matched your search
@@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class WheelVisuals : MonoBehaviour
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct WheelPair
|
||||
{
|
||||
public WheelCollider collider;
|
||||
public Transform mesh;
|
||||
}
|
||||
|
||||
[Header("Привязка колес")]
|
||||
public WheelPair[] wheels;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
foreach (var w in wheels)
|
||||
{
|
||||
if (w.collider == null || w.mesh == null) continue;
|
||||
|
||||
// Получаем физическую позицию колеса
|
||||
w.collider.GetWorldPose(out Vector3 pos, out Quaternion rot);
|
||||
|
||||
// Применяем к 3D-модели
|
||||
w.mesh.position = pos;
|
||||
w.mesh.rotation = rot;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user