feat: improve VR menu pointer and BeatSaber flow

This commit is contained in:
jongjae0305
2026-05-26 17:13:02 +09:00
parent 58838f0acb
commit 10e9ebae45
20 changed files with 637 additions and 58 deletions
+1
View File
@@ -7,5 +7,6 @@
*.wav binary
*.mp3 binary
*.ogg binary
*.mp4 binary
*.fbx binary
*.asset binary
+1
View File
@@ -9,6 +9,7 @@
# IDE / Generated
*.csproj
*.csproj.user
*.slnx
*.sln
.vscode/
+17 -22
View File
@@ -150,10 +150,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 441482e8936e35048a1dffac814e3ef8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Profile: {fileID: 11400000, guid: 8882f7434ef4fcd458f02738f32c7b11, type: 2}
m_StaticLightingSkyUniqueID: 0
m_SkySettings: {fileID: 0}
m_SkySettingsFromProfile: {fileID: 0}
--- !u!4 &72731932
Transform:
m_ObjectHideFlags: 1
@@ -616,42 +612,42 @@ PrefabInstance:
- target: {fileID: 7481659171502770090, guid: d614df01a29ad3e45bb831298dfbad2c,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.3567679
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7481659171502770090, guid: d614df01a29ad3e45bb831298dfbad2c,
type: 3}
propertyPath: m_LocalPosition.y
value: -0.4698689
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7481659171502770090, guid: d614df01a29ad3e45bb831298dfbad2c,
type: 3}
propertyPath: m_LocalPosition.z
value: -0.22523999
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7481659171502770090, guid: d614df01a29ad3e45bb831298dfbad2c,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.99958926
value: 0.9239
objectReference: {fileID: 0}
- target: {fileID: 7481659171502770090, guid: d614df01a29ad3e45bb831298dfbad2c,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
value: 0.3827
objectReference: {fileID: 0}
- target: {fileID: 7481659171502770090, guid: d614df01a29ad3e45bb831298dfbad2c,
type: 3}
propertyPath: m_LocalRotation.y
value: -0.028659718
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7481659171502770090, guid: d614df01a29ad3e45bb831298dfbad2c,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7481659171502770090, guid: d614df01a29ad3e45bb831298dfbad2c,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
value: 45
objectReference: {fileID: 0}
- target: {fileID: 7481659171502770090, guid: d614df01a29ad3e45bb831298dfbad2c,
type: 3}
@@ -4558,7 +4554,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3f8ab482667b2f44691ffe7131ffbdb7, type: 3}
m_Name:
m_EditorClassIdentifier:
sceneName: Menu
--- !u!1 &2138780048
GameObject:
m_ObjectHideFlags: 0
@@ -4883,17 +4878,17 @@ PrefabInstance:
- target: {fileID: 3968956848465607219, guid: f555cbb0b089fb64ca7c7a5b07f11520,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.36676788
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3968956848465607219, guid: f555cbb0b089fb64ca7c7a5b07f11520,
type: 3}
propertyPath: m_LocalPosition.y
value: -0.18886888
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3968956848465607219, guid: f555cbb0b089fb64ca7c7a5b07f11520,
type: 3}
propertyPath: m_LocalPosition.z
value: -0.23423982
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3968956848465607219, guid: f555cbb0b089fb64ca7c7a5b07f11520,
type: 3}
@@ -5093,17 +5088,17 @@ PrefabInstance:
- target: {fileID: 1002067974212273307, guid: e7173b1ee3369204eb181b376ede2a3e,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.36676788
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1002067974212273307, guid: e7173b1ee3369204eb181b376ede2a3e,
type: 3}
propertyPath: m_LocalPosition.y
value: -0.18886888
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1002067974212273307, guid: e7173b1ee3369204eb181b376ede2a3e,
type: 3}
propertyPath: m_LocalPosition.z
value: -0.23423982
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1002067974212273307, guid: e7173b1ee3369204eb181b376ede2a3e,
type: 3}
@@ -5305,17 +5300,17 @@ PrefabInstance:
- target: {fileID: 7481659171502770090, guid: d614df01a29ad3e45bb831298dfbad2c,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.3567679
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7481659171502770090, guid: d614df01a29ad3e45bb831298dfbad2c,
type: 3}
propertyPath: m_LocalPosition.y
value: -0.4698689
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7481659171502770090, guid: d614df01a29ad3e45bb831298dfbad2c,
type: 3}
propertyPath: m_LocalPosition.z
value: -0.22523999
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7481659171502770090, guid: d614df01a29ad3e45bb831298dfbad2c,
type: 3}
+278
View File
@@ -0,0 +1,278 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using UnityEngine.XR;
namespace VRBeats
{
[RequireComponent(typeof(LineRenderer))]
public class VRPointerController : MonoBehaviour
{
[SerializeField] private bool isRightHand = true;
[SerializeField] private float maxDistance = 50f;
private LineRenderer _line;
private bool _prevTrigger;
private Selectable _currentHover;
private static readonly Color NormalColor = new Color(1f, 1f, 1f, 0.8f);
private static readonly Color HoverColor = new Color(0.3f, 0.8f, 1f, 1f);
private float _deviceLogTimer;
// 버튼별 이전 상태
private bool _prevGrip;
private bool _prevPrimary;
private bool _prevSecondary;
private bool _prevThumbstick;
private void Awake()
{
_line = GetComponent<LineRenderer>();
_line.positionCount = 2;
_line.startWidth = 0.005f;
_line.endWidth = 0.001f;
_line.useWorldSpace = true;
// enabled 상태는 OnEnable/OnDisable이 관리 — Awake에서 건드리지 않음
}
private void Start()
{
// Awake 이후 reflection으로 isRightHand가 설정되므로 Start에서 로그
Debug.Log($"[VRPointer] Start — {gameObject.name} / isRightHand={isRightHand}");
}
private void OnEnable()
{
if (_line != null) _line.enabled = true;
}
private void OnDisable()
{
if (_line != null) _line.enabled = false;
}
private void Update()
{
// 3초마다 연결된 디바이스 목록 출력
_deviceLogTimer += Time.deltaTime;
if (_deviceLogTimer >= 3f)
{
_deviceLogTimer = 0f;
LogConnectedDevices();
}
bool trigger = GetButton(CommonUsages.triggerButton);
bool grip = GetButton(CommonUsages.gripButton);
bool primary = GetButton(CommonUsages.primaryButton);
bool secondary = GetButton(CommonUsages.secondaryButton);
bool thumbstick = GetButton(CommonUsages.primary2DAxisClick);
bool triggerDown = trigger && !_prevTrigger;
bool gripDown = grip && !_prevGrip;
bool primaryDown = primary && !_prevPrimary;
bool secondaryDown = secondary && !_prevSecondary;
bool thumbstickDown = thumbstick && !_prevThumbstick;
_prevTrigger = trigger;
_prevGrip = grip;
_prevPrimary = primary;
_prevSecondary = secondary;
_prevThumbstick = thumbstick;
string hand = isRightHand ? "R" : "L";
if (triggerDown) Debug.Log($"[VRPointer:{hand}] 검지 트리거 눌림");
if (gripDown) Debug.Log($"[VRPointer:{hand}] 그립(중지) 눌림");
if (primaryDown) Debug.Log($"[VRPointer:{hand}] {(isRightHand ? "A" : "X")} 버튼 눌림");
if (secondaryDown) Debug.Log($"[VRPointer:{hand}] {(isRightHand ? "B" : "Y")} 버튼 눌림");
if (thumbstickDown)Debug.Log($"[VRPointer:{hand}] 조이스틱 클릭 눌림");
Ray ray = new Ray(transform.position, transform.forward);
float hitDist = maxDistance;
Selectable hit = FindSelectableUnderRay(ray, ref hitDist);
// 호버 변화 로그
if (hit != _currentHover)
{
Debug.Log(hit != null
? $"[VRPointer] HOVER → {hit.gameObject.name}"
: $"[VRPointer] HOVER → (없음)");
}
UpdateHoverState(hit);
// 검지 트리거 또는 A/X 버튼으로 클릭
if (triggerDown || primaryDown)
{
if (_currentHover != null)
{
string btn = triggerDown ? "검지 트리거" : (isRightHand ? "A" : "X");
Debug.Log($"[VRPointer:{hand}] CLICK [{btn}] → {_currentHover.gameObject.name}");
Click(_currentHover);
}
else
{
Debug.Log($"[VRPointer:{hand}] CLICK — 레이 아래 버튼 없음 " +
$"pos={transform.position:F2} fwd={transform.forward:F2}");
DebugRaycastAttempt(new Ray(transform.position, transform.forward));
}
}
DrawLine(hitDist);
}
private void LogConnectedDevices()
{
var all = new List<InputDevice>();
InputDevices.GetDevices(all);
if (all.Count == 0)
{
Debug.LogWarning($"[VRPointer] 연결된 XR 디바이스 없음 ({gameObject.name})");
return;
}
var chars = InputDeviceCharacteristics.Controller |
(isRightHand ? InputDeviceCharacteristics.Right : InputDeviceCharacteristics.Left);
var matched = new List<InputDevice>();
InputDevices.GetDevicesWithCharacteristics(chars, matched);
Debug.Log($"[VRPointer] 전체 디바이스 {all.Count}개 | " +
$"{(isRightHand ? "" : "")} 컨트롤러 {matched.Count}개 ({gameObject.name})");
}
private void UpdateHoverState(Selectable hit)
{
if (hit == _currentHover) return;
var es = EventSystem.current;
if (_currentHover != null)
ExecuteEvents.Execute(_currentHover.gameObject,
new PointerEventData(es), ExecuteEvents.pointerExitHandler);
_currentHover = hit;
if (_currentHover != null)
ExecuteEvents.Execute(_currentHover.gameObject,
new PointerEventData(es), ExecuteEvents.pointerEnterHandler);
}
private static void Click(Selectable sel)
{
var es = EventSystem.current;
if (es == null)
{
Debug.LogWarning("[VRPointer] EventSystem.current is null — click 실패");
return;
}
var eventData = new PointerEventData(es);
ExecuteEvents.Execute(sel.gameObject, eventData, ExecuteEvents.pointerDownHandler);
ExecuteEvents.Execute(sel.gameObject, eventData, ExecuteEvents.pointerUpHandler);
ExecuteEvents.Execute(sel.gameObject, eventData, ExecuteEvents.pointerClickHandler);
var btn = sel.GetComponent<Button>();
if (btn != null) btn.onClick.Invoke();
}
private void DrawLine(float hitDist)
{
Color c = _currentHover != null ? HoverColor : NormalColor;
_line.startColor = c;
_line.endColor = new Color(c.r, c.g, c.b, 0f);
_line.SetPosition(0, transform.position);
_line.SetPosition(1, transform.position + transform.forward * hitDist);
}
private static void DebugRaycastAttempt(Ray ray)
{
var all = Selectable.allSelectablesArray;
Debug.Log($"[VRPointer:DEBUG] Selectable 총 {all.Length}개 | ray.origin={ray.origin:F2} ray.dir={ray.direction:F2}");
foreach (Selectable sel in all)
{
if (!sel.gameObject.activeInHierarchy) { Debug.Log($" SKIP(비활성) {sel.gameObject.name}"); continue; }
if (!sel.interactable) { Debug.Log($" SKIP(interactable=false) {sel.gameObject.name}"); continue; }
var rt = sel.GetComponent<RectTransform>();
if (rt == null) { Debug.Log($" SKIP(RectTransform없음) {sel.gameObject.name}"); continue; }
Vector3[] c = new Vector3[4];
rt.GetWorldCorners(c);
Vector3 normal = rt.forward;
if (Vector3.Dot(normal, ray.direction) >= 0f) normal = -normal;
Plane plane = new Plane(normal, c[0]);
bool hit = plane.Raycast(ray, out float dist);
if (!hit) { Debug.Log($" MISS(Plane.Raycast=false) {sel.gameObject.name} | rtPos={rt.position:F2} normal={normal:F2}"); continue; }
bool inRect = IsPointInRect(ray.GetPoint(dist), c);
Debug.Log($" {(inRect ? "HIT" : "MISS(InRect=false)")} {sel.gameObject.name} | dist={dist:F2} inRect={inRect}");
}
}
private static Selectable FindSelectableUnderRay(Ray ray, ref float maxDist)
{
Selectable closest = null;
float closestDist = maxDist;
foreach (Selectable sel in Selectable.allSelectablesArray)
{
if (!sel.gameObject.activeInHierarchy || !sel.interactable) continue;
var rt = sel.GetComponent<RectTransform>();
if (rt == null) continue;
Vector3[] corners = new Vector3[4];
rt.GetWorldCorners(corners);
// Plane.Raycast은 normal 쪽(앞면)에서 레이가 출발해야 true 반환.
// rt.forward가 카메라 반대를 향할 수 있으므로 레이 원점 방향으로 노말 보정.
Vector3 normal = rt.forward;
if (Vector3.Dot(normal, ray.direction) >= 0f)
normal = -normal;
Plane plane = new Plane(normal, corners[0]);
if (!plane.Raycast(ray, out float dist)) continue;
if (dist >= closestDist || dist <= 0f) continue;
if (!IsPointInRect(ray.GetPoint(dist), corners)) continue;
closestDist = dist;
closest = sel;
}
maxDist = closestDist;
return closest;
}
private static bool IsPointInRect(Vector3 p, Vector3[] c)
{
Vector3 toP = p - c[0];
Vector3 right = c[3] - c[0];
Vector3 up = c[1] - c[0];
float r = Vector3.Dot(toP, right) / right.sqrMagnitude;
float u = Vector3.Dot(toP, up) / up.sqrMagnitude;
return r >= 0f && r <= 1f && u >= 0f && u <= 1f;
}
private bool GetButton(InputFeatureUsage<bool> usage)
{
var chars = InputDeviceCharacteristics.Controller |
(isRightHand
? InputDeviceCharacteristics.Right
: InputDeviceCharacteristics.Left);
var devices = new List<InputDevice>();
InputDevices.GetDevicesWithCharacteristics(chars, devices);
if (devices.Count == 0) return false;
devices[0].TryGetFeatureValue(usage, out bool pressed);
return pressed;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: eec74ab726176d74491e9be716a7a609
+53
View File
@@ -0,0 +1,53 @@
using UnityEngine;
using UnityEngine.SceneManagement;
namespace VRBeats
{
// 모든 씬에서 자동 실행.
// Game 씬: VRPointerController를 비활성 상태로 추가 → VR_InteractorController가 게임오버 시 활성화.
// 나머지 씬: 바로 활성 상태로 추가.
public class VRPointerSetup : MonoBehaviour
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
private static void AutoInject()
{
var go = new GameObject("[VRPointerSetup]");
go.AddComponent<VRPointerSetup>();
}
private void Start()
{
bool isGameScene = SceneManager.GetActiveScene().name == "Game";
SetupControllers(disabledByDefault: isGameScene);
}
private static void SetupControllers(bool disabledByDefault)
{
foreach (var go in FindObjectsByType<GameObject>(FindObjectsSortMode.None))
{
string name = go.name;
bool isRight = name.Contains("Right");
bool isLeft = name.Contains("Left");
if (!isRight && !isLeft) continue;
if (!name.Contains("Controller") && !name.Contains("Hand")) continue;
if (go.GetComponent<LineRenderer>() == null) continue;
if (go.GetComponent<VRPointerController>() != null) continue;
var pointer = go.AddComponent<VRPointerController>();
var field = typeof(VRPointerController)
.GetField("isRightHand",
System.Reflection.BindingFlags.NonPublic |
System.Reflection.BindingFlags.Instance);
field?.SetValue(pointer, isRight);
// Game 씬에서는 게임오버 전까지 비활성
if (disabledByDefault)
pointer.enabled = false;
Debug.Log($"[VRPointerSetup] {(isRight ? "Right" : "Left")} pointer 추가: {go.name} (enabled={!disabledByDefault})");
}
}
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 38f89babd4e99734aac47edbc4f87aa3
File diff suppressed because one or more lines are too long
@@ -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}
+19 -6
View File
@@ -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;
}
}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6fb30ae126e70f441a51ad0652c5e708
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
+18
View File
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: b1b477339527b404585e10e42a15d653
VideoClipImporter:
externalObjects: {}
serializedVersion: 3
frameRange: 0
startFrame: -1
endFrame: -1
colorSpace: 0
deinterlace: 0
encodeAlpha: 0
flipVertical: 0
flipHorizontal: 0
importAudio: 1
targetSettings: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

+143
View File
@@ -0,0 +1,143 @@
fileFormatVersion: 2
guid: 6765d030cfc5fc84e9523fcd9439be89
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 0
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
+1
View File
@@ -1,5 +1,6 @@
{
"dependencies": {
"com.unity.2d.sprite": "1.0.0",
"com.unity.ai.navigation": "2.0.11",
"com.unity.collab-proxy": "2.11.4",
"com.unity.ide.rider": "3.0.39",
+6
View File
@@ -1,5 +1,11 @@
{
"dependencies": {
"com.unity.2d.sprite": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.ai.navigation": {
"version": "2.0.11",
"depth": 0,