고정각도 회전
This commit is contained in:
@@ -393,6 +393,11 @@ private void RotateTowardPlayer(Transform target)
|
||||
|
||||
private void RotateToRotation(Transform target, Quaternion rotation) => AddRotationJob(target, rotation, hold: false);
|
||||
|
||||
// 화자를 특정 월드 Y각(yaw)으로 고정 회전한다. hold=true라 대화 동안 Animator가 루트를 덮어써도 유지되고,
|
||||
// 대화 종료 시 _originalRotations 복원으로 원래 각도로 돌아간다. (특정 각도 전용 애니메이션용)
|
||||
private void RotateToFixedYaw(Transform target, float yawDegrees)
|
||||
=> AddRotationJob(target, Quaternion.Euler(0f, yawDegrees, 0f), hold: true);
|
||||
|
||||
// 플레이어가 지정 위치를 바라보도록 리그를 수평(yaw)으로만 돌린다.
|
||||
// VR에서는 HMD 카메라를 직접 못 돌리므로 "Player" 태그 루트(XR Origin)를 돌려서
|
||||
// 카메라 정면이 목표를 향하게 한다. 대화가 끝나도 원상복구하지 않는다 (플레이어 시점이므로).
|
||||
@@ -548,6 +553,15 @@ private async Awaitable<bool> PlayNode(DialogNode node)
|
||||
RotatePlayerToward(voiceObj.transform.position);
|
||||
}
|
||||
|
||||
// 고정 각도 회전 — 특정 각도에서만 자연스러운 애니메이션/제스처용 (화자, 못 찾으면 대화 주인 NPC)
|
||||
if (node.UseFixedAngle)
|
||||
{
|
||||
var speakerObj = node.Speaker != null ? CharacterVoiceObject.Find(node.Speaker) : null;
|
||||
var fixedTarget = speakerObj != null ? speakerObj.transform : transform;
|
||||
_originalRotations.TryAdd(fixedTarget, GetOriginalRotation(fixedTarget));
|
||||
RotateToFixedYaw(fixedTarget, node.FixedAngleY);
|
||||
}
|
||||
|
||||
// 제스처/표정은 화자(Target)의 Animator에 적용 — 끼어든 NPC의 대사/연출 노드도 그 캐릭터가 움직인다.
|
||||
// 화자를 못 찾으면 대화 주인 NPC의 Animator로 폴백.
|
||||
if (node.Gesture != null || node.Expression != null)
|
||||
|
||||
Reference in New Issue
Block a user