Fix Screen Wrapping visual rotation offset and OneWay platform bottom collision

Подробный список изменений:
- В JumpPlayerController.cs в методе CopyWrappedVisuals возвращено мировое позиционирование и вращение клонов с оффсетом (вместо локальных). Это полностью исправило баг двойной трансформации поворота родительского объекта, из-за которого клон лежал на боку.
- В OneWayPlatformCollider.cs добавлено отслеживание позиции платформы. В FixedUpdate, если позиция платформы изменилась по сравнению с предыдущим кадром, вызывается UpdateCachedTopY. Это решило проблему ложного срабатывания коллизии при прыжке сквозь перенесенные вверх платформы.
This commit is contained in:
Данил Ярош 2026-07-03 16:51:08 +03:00
parent 15adf94b21
commit 4e8c258824
13 changed files with 24530 additions and 3 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d37641bc43aa8a5409199e458d4eabba
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fc563a14f212643468c4cd3a2520fa93
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6e2885d269ac0da48a7845117ba29f16
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e0b60ede207833d4190096335996bac5
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4d09f2717174d4f42bcbbf6d496bebe3
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1723,7 +1723,7 @@ namespace DanroJump.Gameplay
{
if (wrapVisualCloneRoot != null)
{
wrapVisualCloneRoot.localPosition = offset;
wrapVisualCloneRoot.localPosition = Vector3.zero;
}
for (var index = 0; index < sourceRenderers.Count; index++)
@ -1755,8 +1755,8 @@ namespace DanroJump.Gameplay
clone.sortingLayerID = source.sortingLayerID;
clone.sortingOrder = source.sortingOrder;
clone.sharedMaterial = source.sharedMaterial;
clone.transform.localPosition = source.transform.localPosition;
clone.transform.localRotation = source.transform.localRotation;
clone.transform.position = source.transform.position + offset;
clone.transform.rotation = source.transform.rotation;
clone.transform.localScale = source.transform.localScale;
clone.gameObject.layer = source.gameObject.layer;
}

View File

@ -20,6 +20,7 @@ namespace DanroJump.Gameplay
private BoxCollider2D boxPlatformCollider;
private Collider2D playerCollider;
private float cachedTopY;
private Vector3 lastPosition;
private bool isIgnoringPlayerCollision;
/// <summary>
@ -68,6 +69,7 @@ namespace DanroJump.Gameplay
}
UpdateCachedTopY();
lastPosition = transform.position;
RefreshColliderState();
}
@ -77,6 +79,7 @@ namespace DanroJump.Gameplay
private void OnEnable()
{
UpdateCachedTopY();
lastPosition = transform.position;
RefreshColliderState();
}
@ -98,6 +101,13 @@ namespace DanroJump.Gameplay
return;
}
// Если платформа переместилась (например, была рециклирована), принудительно обновляем кэш
if (transform.position != lastPosition)
{
UpdateCachedTopY();
lastPosition = transform.position;
}
// Оптимизация: если игрок взлетает вверх, коллизия гарантированно игнорируется.
// Это избавляет от выполнения сложных вычислений расстояний для всех платформ.
var isFalling = player.VerticalVelocity <= landingVelocityThreshold ||

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ee117db74a8c4bb4f9cc8c9294b2918c