Fix blackjack hook dialog placement
This commit is contained in:
BIN
Assets/01_Scenes/blackjack.unity
LFS
BIN
Assets/01_Scenes/blackjack.unity
LFS
Binary file not shown.
8
Assets/02_Scripts/Communication/Dialog/blackjack.meta
Normal file
8
Assets/02_Scripts/Communication/Dialog/blackjack.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9da98374aa5716949a8d2c32ea5967cc
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class BlackjackDialogHudFix : MonoBehaviour
|
||||||
|
{
|
||||||
|
[Header("Anchor")]
|
||||||
|
public Transform speakerAnchor; // 후크 기준 위치
|
||||||
|
public Camera targetCamera; // 비워두면 Camera.main 사용
|
||||||
|
|
||||||
|
[Header("Panel Check")]
|
||||||
|
public GameObject dialoguePanel; // DialoguePanel 넣기
|
||||||
|
public bool onlyWhenPanelActive = true;
|
||||||
|
|
||||||
|
[Header("Placement")]
|
||||||
|
public float chestHeight = 2.0f;
|
||||||
|
public float forwardOffset = 0.7f;
|
||||||
|
public float lateralOffset = 0f;
|
||||||
|
|
||||||
|
private void LateUpdate()
|
||||||
|
{
|
||||||
|
if (speakerAnchor == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (onlyWhenPanelActive && dialoguePanel != null && !dialoguePanel.activeInHierarchy)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Camera cam = targetCamera != null ? targetCamera : Camera.main;
|
||||||
|
|
||||||
|
if (cam == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Vector3 toCam = cam.transform.position - speakerAnchor.position;
|
||||||
|
toCam.y = 0f;
|
||||||
|
|
||||||
|
if (toCam.sqrMagnitude < 0.0001f)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Vector3 dir = toCam.normalized;
|
||||||
|
Vector3 right = Vector3.Cross(Vector3.up, dir).normalized;
|
||||||
|
|
||||||
|
Vector3 chestWorld = speakerAnchor.position + Vector3.up * chestHeight;
|
||||||
|
|
||||||
|
transform.position =
|
||||||
|
chestWorld +
|
||||||
|
dir * forwardOffset +
|
||||||
|
right * lateralOffset;
|
||||||
|
|
||||||
|
transform.rotation = Quaternion.LookRotation(-dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2b4bf258be179644ca6c223f911e15c7
|
||||||
@@ -260,7 +260,7 @@ MonoBehaviour:
|
|||||||
- rid: 6595524353106116644
|
- rid: 6595524353106116644
|
||||||
type: {class: 'Constant`1[[System.Boolean, mscorlib]]', ns: Unity.GraphToolkit.Editor, asm: Unity.GraphToolkit.Internal.Editor}
|
type: {class: 'Constant`1[[System.Boolean, mscorlib]]', ns: Unity.GraphToolkit.Editor, asm: Unity.GraphToolkit.Internal.Editor}
|
||||||
data:
|
data:
|
||||||
m_Value: 1
|
m_Value: 0
|
||||||
- rid: 6595524353106116645
|
- rid: 6595524353106116645
|
||||||
type: {class: DialogLineNode, ns: WhaleAdventure.Dialog.GraphTool.Editor, asm: Assembly-CSharp-Editor}
|
type: {class: DialogLineNode, ns: WhaleAdventure.Dialog.GraphTool.Editor, asm: Assembly-CSharp-Editor}
|
||||||
data:
|
data:
|
||||||
|
|||||||
Reference in New Issue
Block a user