+ Add : Plugin fbx integration
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user