using System; using System.Collections.Generic; using UnityEngine; /// /// OptiTrack 스켈레톤의 본 매핑과 T-포즈를 에셋으로 영구 저장합니다. /// 런타임에 Start()에서 자동 로드되며, CacheRestPose() 없이 즉시 복원이 가능합니다. /// [CreateAssetMenu(fileName = "OptitrackRestPoseData", menuName = "OptiTrack/Skeleton Setup")] public class OptitrackRestPoseData : ScriptableObject { // ── 본 매핑 ─────────────────────────────────────────────────────────────── /// /// OptiTrack 본 이름 ↔ FBX 노드 이름 매핑 목록. /// Transform 참조(cachedTransform)는 씬 오브젝트라 SO에 저장되지 않으며, /// 런타임 Start()에서 자동으로 채워집니다. /// public List boneMappings = new List(); // ── T-포즈 (기준 포즈) ──────────────────────────────────────────────────── [Serializable] public class RestPoseEntry { public string boneName; public Vector3 localPosition; public Quaternion localRotation; } public List restPoseEntries = new List(); /// /// T-포즈 데이터를 런타임 딕셔너리에 복사합니다. /// public void LoadRestPoseIntoRuntime( Dictionary rotations, Dictionary positions) { rotations.Clear(); positions.Clear(); foreach (var e in restPoseEntries) { rotations[e.boneName] = e.localRotation; positions[e.boneName] = e.localPosition; } } }