+ Add : Plugin fbx integration

This commit is contained in:
Ferlat Thibaud
2026-03-24 20:11:39 +01:00
parent a16a9b1837
commit b1c1b31354
169 changed files with 18357 additions and 1242 deletions
@@ -206,6 +206,18 @@ namespace Unheimlich.Features.Dialogue.UI
_shakeOffset = Vector3.zero;
}
/// <summary>
/// Syncs the ghost word's sibling index so depth sorting covers both the main word and its ghost trail.
/// Should be called right after SetSiblingIndex on the main word.
/// </summary>
public void SyncGhostSiblingIndex(int mainSiblingIndex)
{
if (_ghostTextComponent == null) return;
// Place ghost just before its main word so it renders underneath it.
int ghostIndex = Mathf.Max(0, mainSiblingIndex - 1);
_ghostTextComponent.transform.SetSiblingIndex(ghostIndex);
}
public void SetShakeSpeedMultiplier(float multiplier)
{
_shakeSpeedMultiplier = Mathf.Max(0f, multiplier);
@@ -366,28 +366,7 @@ namespace Unheimlich.Features.Dialogue.UI
_sortTimer = 0f;
Camera mainCamera = Camera.main;
if (mainCamera == null)
return;
Vector3 cameraPosition = mainCamera.transform.position;
_activeChoices.Sort((a, b) =>
{
if (a == null || b == null)
return 0;
float distanceA = Vector3.Distance(cameraPosition, a.transform.position);
float distanceB = Vector3.Distance(cameraPosition, b.transform.position);
return distanceB.CompareTo(distanceA);
});
for (int i = 0; i < _activeChoices.Count; i++)
{
if (_activeChoices[i] != null)
_activeChoices[i].transform.SetSiblingIndex(i);
}
FloatingWordsSpawner.SortByDistance(_activeChoices, Camera.main);
}
}
}
@@ -374,6 +374,40 @@ namespace Unheimlich.Features.Dialogue.UI
}
#endregion
#region Depth Sorting
/// <summary>
/// Sorts words by distance to camera so closer words render on top via sibling index.
/// Ghost trails are synced to always sit just below their main word.
/// Shared by ObjectDescriptionTrigger and DialogueUI to avoid duplication.
/// Sorts a temporary copy to preserve the original list order, which may be index-coupled
/// to spawn positions (e.g. _originalSpawnPositions in ObjectDescriptionTrigger).
/// </summary>
public static void SortByDistance(List<ChoiceFocusHandler> words, Camera camera)
{
if (words.Count <= 1 || camera == null) return;
Vector3 cameraPosition = camera.transform.position;
List<ChoiceFocusHandler> sorted = new List<ChoiceFocusHandler>(words);
sorted.Sort((a, b) =>
{
if (a == null || b == null) return 0;
float dA = Vector3.Distance(cameraPosition, a.transform.position);
float dB = Vector3.Distance(cameraPosition, b.transform.position);
return dA.CompareTo(dB);
});
for (int i = 0; i < sorted.Count; i++)
{
if (sorted[i] != null)
{
sorted[i].transform.SetSiblingIndex(i);
sorted[i].SyncGhostSiblingIndex(i);
}
}
}
#endregion
#region Tools
private static Vector3 CalculateCircularPosition(float angleRad, float radius, RotationAxis axis, float heightOffset)
{