Супер сырая система с заменой колес. Надо дорабатывать еще.
This commit is contained in:
1 parent
5f25a8eab4
commit
a497916ad0
1424 files changed
+6339
-91467
No files matched your search
@@ -183,7 +183,11 @@ public class CarController : MonoBehaviour
|
||||
|
||||
private void UpdateWheelPose(WheelCollider collider, Transform mesh)
|
||||
{
|
||||
if (mesh == null) return;
|
||||
// Если меш не назначен, коллайдер выключен или колесо снято с машины
|
||||
// (больше не является дочерним объектом этого авто) — не двигаем его!
|
||||
if (mesh == null || collider == null || !collider.enabled || !mesh.IsChildOf(transform))
|
||||
return;
|
||||
|
||||
collider.GetWorldPose(out Vector3 pos, out Quaternion rot);
|
||||
mesh.position = pos;
|
||||
mesh.rotation = rot;
|
||||
|
||||
Reference in new issue
Block a user