Fix : 스크립트 속성및 설정 업데이트

This commit is contained in:
qsxft258@gmail.com 2025-08-29 14:54:39 +09:00
parent 5915440f39
commit f58543435a
3 changed files with 55 additions and 2 deletions

View File

@ -134,6 +134,19 @@ namespace KindRetargeting
public List<RotationOffsetData> rotationOffsetCache; public List<RotationOffsetData> rotationOffsetCache;
public float initialHipsHeight; public float initialHipsHeight;
public float avatarScale; public float avatarScale;
// LimbWeightController 설정들
public float maxDistance;
public float minDistance;
public float weightSmoothSpeed;
public float hipsMinDistance;
public float hipsMaxDistance;
public bool useFixedChairGap;
public float chairHipsFixedGap;
public float groundHipsMinHeight;
public float groundHipsMaxHeight;
public float footHeightMinThreshold;
public float footHeightMaxThreshold;
} }
// 각 손가락 관절별로 필터 버퍼를 관리하는 Dictionary 추가 // 각 손가락 관절별로 필터 버퍼를 관리하는 Dictionary 추가
@ -340,6 +353,9 @@ namespace KindRetargeting
offsetCache.Add(new RotationOffsetData((int)kvp.Key, kvp.Value)); offsetCache.Add(new RotationOffsetData((int)kvp.Key, kvp.Value));
} }
// LimbWeightController 컴포넌트 가져오기
var limbWeightController = GetComponent<LimbWeightController>();
var settings = new RetargetingSettings var settings = new RetargetingSettings
{ {
hipsWeight = hipsWeight, hipsWeight = hipsWeight,
@ -356,6 +372,19 @@ namespace KindRetargeting
rotationOffsetCache = offsetCache, rotationOffsetCache = offsetCache,
initialHipsHeight = initialHipsHeight, initialHipsHeight = initialHipsHeight,
avatarScale = avatarScale, avatarScale = avatarScale,
// LimbWeightController 설정들 저장
maxDistance = limbWeightController?.maxDistance ?? 0.5f,
minDistance = limbWeightController?.minDistance ?? 0.1f,
weightSmoothSpeed = limbWeightController?.weightSmoothSpeed ?? 10f,
hipsMinDistance = limbWeightController?.hipsMinDistance ?? 0.2f,
hipsMaxDistance = limbWeightController?.hipsMaxDistance ?? 0.6f,
useFixedChairGap = limbWeightController?.useFixedChairGap ?? true,
chairHipsFixedGap = limbWeightController?.chairHipsFixedGap ?? 0.1f,
groundHipsMinHeight = limbWeightController?.groundHipsMinHeight ?? 0f,
groundHipsMaxHeight = limbWeightController?.groundHipsMaxHeight ?? 0.5f,
footHeightMinThreshold = limbWeightController?.footHeightMinThreshold ?? 0.2f,
footHeightMaxThreshold = limbWeightController?.footHeightMaxThreshold ?? 0.5f,
}; };
string json = JsonUtility.ToJson(settings, true); string json = JsonUtility.ToJson(settings, true);
@ -412,6 +441,23 @@ namespace KindRetargeting
initialHipsHeight = settings.initialHipsHeight; initialHipsHeight = settings.initialHipsHeight;
avatarScale = settings.avatarScale; avatarScale = settings.avatarScale;
previousScale = avatarScale; previousScale = avatarScale;
// LimbWeightController 설정들 로드
var limbWeightController = GetComponent<LimbWeightController>();
if (limbWeightController != null)
{
limbWeightController.maxDistance = settings.maxDistance;
limbWeightController.minDistance = settings.minDistance;
limbWeightController.weightSmoothSpeed = settings.weightSmoothSpeed;
limbWeightController.hipsMinDistance = settings.hipsMinDistance;
limbWeightController.hipsMaxDistance = settings.hipsMaxDistance;
limbWeightController.useFixedChairGap = settings.useFixedChairGap;
limbWeightController.chairHipsFixedGap = settings.chairHipsFixedGap;
limbWeightController.groundHipsMinHeight = settings.groundHipsMinHeight;
limbWeightController.groundHipsMaxHeight = settings.groundHipsMaxHeight;
limbWeightController.footHeightMinThreshold = settings.footHeightMinThreshold;
limbWeightController.footHeightMaxThreshold = settings.footHeightMaxThreshold;
}

View File

@ -448,6 +448,7 @@ public class RetargetingControlWindow : EditorWindow
limb.weightSmoothSpeed = 10f; limb.weightSmoothSpeed = 10f;
limb.groundHipsMinHeight = 0.3f; limb.groundHipsMinHeight = 0.3f;
limb.groundHipsMaxHeight = 0.7f; limb.groundHipsMaxHeight = 0.7f;
limb.chairHipsFixedGap = 0.1f;
EditorUtility.SetDirty(limb); EditorUtility.SetDirty(limb);
} }
@ -491,6 +492,8 @@ public class RetargetingControlWindow : EditorWindow
preset.limbMinDistance = limb.minDistance; preset.limbMinDistance = limb.minDistance;
preset.footHeightMinThreshold = limb.footHeightMinThreshold; preset.footHeightMinThreshold = limb.footHeightMinThreshold;
preset.footHeightMaxThreshold = limb.footHeightMaxThreshold; preset.footHeightMaxThreshold = limb.footHeightMaxThreshold;
preset.useFixedChairGap = limb.useFixedChairGap;
preset.chairHipsFixedGap = limb.chairHipsFixedGap;
} }
presets[currentPresetName] = preset; presets[currentPresetName] = preset;
@ -519,6 +522,8 @@ public class RetargetingControlWindow : EditorWindow
limb.minDistance = preset.limbMinDistance; limb.minDistance = preset.limbMinDistance;
limb.footHeightMinThreshold = preset.footHeightMinThreshold; limb.footHeightMinThreshold = preset.footHeightMinThreshold;
limb.footHeightMaxThreshold = preset.footHeightMaxThreshold; limb.footHeightMaxThreshold = preset.footHeightMaxThreshold;
limb.useFixedChairGap = preset.useFixedChairGap;
limb.chairHipsFixedGap = preset.chairHipsFixedGap;
} }
EditorUtility.SetDirty(script); EditorUtility.SetDirty(script);
@ -919,7 +924,7 @@ public class RetargetingControlWindow : EditorWindow
EditorGUILayout.PropertyField(useFixedChairGap, new GUIContent("의자 고정 간격 사용")); EditorGUILayout.PropertyField(useFixedChairGap, new GUIContent("의자 고정 간격 사용"));
if (useFixedChairGap.boolValue) if (useFixedChairGap.boolValue)
{ {
EditorGUILayout.PropertyField(chairHipsFixedGap, new GUIContent("의자-허리 고정 간격")); EditorGUILayout.Slider(chairHipsFixedGap, 0f, 0.3f, new GUIContent("의자-허리 고정 간격"));
} }
EditorGUILayout.Space(5); EditorGUILayout.Space(5);
@ -1197,5 +1202,7 @@ public class RetargetingPreset
public float limbMinDistance; public float limbMinDistance;
public float footHeightMinThreshold; public float footHeightMinThreshold;
public float footHeightMaxThreshold; public float footHeightMaxThreshold;
public bool useFixedChairGap;
public float chairHipsFixedGap;
// ... 기타 필요한 설정들 // ... 기타 필요한 설정들
} }

View File

@ -22,7 +22,7 @@ namespace KindRetargeting
[Header("의자 거리 기반 허리 높이 설정")] [Header("의자 거리 기반 허리 높이 설정")]
[SerializeField] public bool useFixedChairGap = true; // 고정 간격 사용 여부 [SerializeField] public bool useFixedChairGap = true; // 고정 간격 사용 여부
[SerializeField, Range(0.1f, 1f)] public float chairHipsFixedGap = 0.2f; // 의자와 허리 간 고정 간격 [SerializeField, Range(0f, 0.3f)] public float chairHipsFixedGap = 0.1f; // 의자와 허리 간 고정 간격
[Header("바닥 기준 히프 보정")] [Header("바닥 기준 히프 보정")]
[SerializeField, Range(0.3f, 1f)] public float groundHipsMinHeight = 0f; // 최소 높이 (가중치 0) [SerializeField, Range(0.3f, 1f)] public float groundHipsMinHeight = 0f; // 최소 높이 (가중치 0)