feat: improve VR menu pointer and BeatSaber flow
This commit is contained in:
@@ -251,23 +251,31 @@ MonoBehaviour:
|
||||
m_OccludeARHitsWith2DObjects: 0
|
||||
m_ScaleMode: 0
|
||||
m_UIPressInput:
|
||||
m_InputSourceMode: 2
|
||||
m_InputSourceMode: 1
|
||||
m_InputActionPerformed:
|
||||
m_Name: UI Press
|
||||
m_Type: 1
|
||||
m_ExpectedControlType:
|
||||
m_ExpectedControlType:
|
||||
m_Id: 0630124c-531b-4795-acfe-690be0b93310
|
||||
m_Processors:
|
||||
m_Interactions:
|
||||
m_SingletonActionBindings: []
|
||||
m_Processors:
|
||||
m_Interactions:
|
||||
m_SingletonActionBindings:
|
||||
- m_Name:
|
||||
m_Id: a1b2c3d4-1111-2222-3333-444455556666
|
||||
m_Path: <XRController>{RightHand}/triggerPressed
|
||||
m_Interactions:
|
||||
m_Processors:
|
||||
m_Groups:
|
||||
m_Action: UI Press
|
||||
m_Flags: 0
|
||||
m_Flags: 0
|
||||
m_InputActionValue:
|
||||
m_Name: UI Press Value
|
||||
m_Type: 0
|
||||
m_ExpectedControlType: Axis
|
||||
m_Id: 48ffb164-f51f-488a-ba88-d99b0e092abc
|
||||
m_Processors:
|
||||
m_Interactions:
|
||||
m_Processors:
|
||||
m_Interactions:
|
||||
m_SingletonActionBindings: []
|
||||
m_Flags: 0
|
||||
m_InputActionReferencePerformed: {fileID: 0}
|
||||
@@ -927,23 +935,31 @@ MonoBehaviour:
|
||||
m_OccludeARHitsWith2DObjects: 0
|
||||
m_ScaleMode: 0
|
||||
m_UIPressInput:
|
||||
m_InputSourceMode: 2
|
||||
m_InputSourceMode: 1
|
||||
m_InputActionPerformed:
|
||||
m_Name: UI Press
|
||||
m_Type: 1
|
||||
m_ExpectedControlType:
|
||||
m_ExpectedControlType:
|
||||
m_Id: bc4a4f29-0c8c-48eb-b453-4183b34bc238
|
||||
m_Processors:
|
||||
m_Interactions:
|
||||
m_SingletonActionBindings: []
|
||||
m_Processors:
|
||||
m_Interactions:
|
||||
m_SingletonActionBindings:
|
||||
- m_Name:
|
||||
m_Id: b2c3d4e5-aaaa-bbbb-cccc-ddddeeeeffff
|
||||
m_Path: <XRController>{LeftHand}/triggerPressed
|
||||
m_Interactions:
|
||||
m_Processors:
|
||||
m_Groups:
|
||||
m_Action: UI Press
|
||||
m_Flags: 0
|
||||
m_Flags: 0
|
||||
m_InputActionValue:
|
||||
m_Name: UI Press Value
|
||||
m_Type: 0
|
||||
m_ExpectedControlType: Axis
|
||||
m_Id: 3ec929fa-8a3d-4c0d-9608-679f56d49a88
|
||||
m_Processors:
|
||||
m_Interactions:
|
||||
m_Processors:
|
||||
m_Interactions:
|
||||
m_SingletonActionBindings: []
|
||||
m_Flags: 0
|
||||
m_InputActionReferencePerformed: {fileID: 0}
|
||||
|
||||
@@ -1625,7 +1625,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 890, y: 666}
|
||||
m_SizeDelta: {x: 850, y: 800}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &359789290
|
||||
MonoBehaviour:
|
||||
@@ -1647,7 +1647,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: eb6ca18f47347e94aa2011847ccd1fa9, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: 6765d030cfc5fc84e9523fcd9439be89, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@@ -4145,6 +4145,7 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 1051307065}
|
||||
- component: {fileID: 1051307064}
|
||||
- component: {fileID: 1051307066}
|
||||
m_Layer: 0
|
||||
m_Name: VR_Manager
|
||||
m_TagString: Untagged
|
||||
@@ -4184,6 +4185,18 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 622937451}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1051307066
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1051307063}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 38f89babd4e99734aac47edbc4f87aa3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::VRBeats.VRPointerSetup
|
||||
--- !u!4 &1143639918 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 748387694978730046, guid: f5d43ad86a21ab1479a999e16359b99b,
|
||||
@@ -5145,7 +5158,7 @@ MonoBehaviour:
|
||||
m_CheckFor3DOcclusion: 0
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 2147483647
|
||||
m_Bits: 4294967295
|
||||
m_RaycastTriggerInteraction: 1
|
||||
--- !u!114 &1445586367
|
||||
MonoBehaviour:
|
||||
@@ -5186,7 +5199,7 @@ MonoBehaviour:
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
m_PresetInfoIsWorld: 1
|
||||
--- !u!223 &1445586369
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -7446,7 +7459,7 @@ MonoBehaviour:
|
||||
m_CheckFor3DOcclusion: 0
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 2147483647
|
||||
m_Bits: 4294967295
|
||||
m_RaycastTriggerInteraction: 1
|
||||
--- !u!114 &1965927025
|
||||
MonoBehaviour:
|
||||
@@ -7487,7 +7500,7 @@ MonoBehaviour:
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
m_PresetInfoIsWorld: 1
|
||||
--- !u!223 &1965927027
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -20,6 +20,11 @@ namespace VRBeats
|
||||
|
||||
public override void DoDamage(DamageInfo info)
|
||||
{
|
||||
// 방향·속도·색상이 맞지 않으면 자르지 않음
|
||||
var beatCube = GetComponent<VR_BeatCube>();
|
||||
if (beatCube != null && !beatCube.IsCutIntentValid(info as BeatDamageInfo))
|
||||
return;
|
||||
|
||||
onCut.Invoke(info);
|
||||
|
||||
var beatDamageInfo = info as BeatDamageInfo;
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace VRBeats
|
||||
public class VR_BeatCube : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float minCutSpeed = 0.5f;
|
||||
[SerializeField] private float maxCutAngle = 40f;
|
||||
[SerializeField] private OnSliceAction sliceAction = null;
|
||||
[SerializeField] private GameEvent onCorrectSlice = null;
|
||||
[SerializeField] private GameEvent onIncorrectSlice = null;
|
||||
@@ -65,7 +66,7 @@ namespace VRBeats
|
||||
|
||||
}
|
||||
|
||||
private bool IsCutIntentValid(BeatDamageInfo info)
|
||||
public bool IsCutIntentValid(BeatDamageInfo info)
|
||||
{
|
||||
if (info == null) return false;
|
||||
|
||||
@@ -76,7 +77,7 @@ namespace VRBeats
|
||||
return true;
|
||||
|
||||
float cutAngle = Vector2.Angle(transform.up, info.hitDir);
|
||||
return info.colorSide == ThisColorSide && cutAngle < 80.0f;
|
||||
return info.colorSide == ThisColorSide && cutAngle < maxCutAngle;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,18 +5,20 @@ namespace VRBeats
|
||||
{
|
||||
public class VR_InteractorController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private bool disableOnAwake = true;
|
||||
|
||||
private UnityEngine.XR.Interaction.Toolkit.Interactors.XRRayInteractor rayInteractor = null;
|
||||
private UnityEngine.XR.Interaction.Toolkit.Interactors.Visuals.XRInteractorLineVisual interactorLineVisual = null;
|
||||
private LineRenderer lineRender = null;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
rayInteractor = GetComponent<UnityEngine.XR.Interaction.Toolkit.Interactors.XRRayInteractor>();
|
||||
interactorLineVisual = GetComponent<UnityEngine.XR.Interaction.Toolkit.Interactors.Visuals.XRInteractorLineVisual>();
|
||||
lineRender = GetComponent<LineRenderer>();
|
||||
|
||||
|
||||
DisableXRRayInteractorComponents();
|
||||
|
||||
if (disableOnAwake)
|
||||
DisableXRRayInteractorComponents();
|
||||
}
|
||||
|
||||
public void DisableXRRayInteractorComponents()
|
||||
@@ -24,13 +26,20 @@ namespace VRBeats
|
||||
rayInteractor.enabled = false;
|
||||
interactorLineVisual.enabled = false;
|
||||
lineRender.enabled = false;
|
||||
|
||||
// VRPointerController는 부모("LeftHand/RightHand Controller")에 추가되므로 InParent로 탐색
|
||||
var pointer = GetComponentInParent<VRPointerController>();
|
||||
if (pointer != null) pointer.enabled = false;
|
||||
}
|
||||
|
||||
public void EnableXRRayInteractorComponents()
|
||||
{
|
||||
{
|
||||
rayInteractor.enabled = true;
|
||||
interactorLineVisual.enabled = true;
|
||||
lineRender.enabled = true;
|
||||
|
||||
var pointer = GetComponentInParent<VRPointerController>();
|
||||
if (pointer != null) pointer.enabled = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user