提交S2替换
This commit is contained in:
@@ -16,8 +16,8 @@ MonoBehaviour:
|
||||
m_RelativeOrientation:
|
||||
m_UserConditions:
|
||||
- m_HandAxis: 2
|
||||
m_AlignmentCondition: 1
|
||||
m_ReferenceDirection: 0
|
||||
m_AlignmentCondition: 2
|
||||
m_ReferenceDirection: 1
|
||||
m_AngleTolerance: 60
|
||||
m_IgnorePositionY: 0
|
||||
m_TargetConditions: []
|
||||
|
||||
@@ -16,8 +16,8 @@ MonoBehaviour:
|
||||
m_RelativeOrientation:
|
||||
m_UserConditions:
|
||||
- m_HandAxis: 0
|
||||
m_AlignmentCondition: 0
|
||||
m_ReferenceDirection: 0
|
||||
m_AlignmentCondition: 2
|
||||
m_ReferenceDirection: 1
|
||||
m_AngleTolerance: 60
|
||||
m_IgnorePositionY: 0
|
||||
m_TargetConditions: []
|
||||
|
||||
@@ -11,13 +11,19 @@ public class QuadCatchCtr : MonoBehaviour
|
||||
|
||||
[Tooltip("张开手丢失后保持就绪的宽限时间(秒),避免手势过渡时漏判")]
|
||||
[SerializeField] private float readyGracePeriod = 0.3f;
|
||||
|
||||
public Camera cam;
|
||||
private bool m_isReady = false;
|
||||
private bool m_isCatching = false;
|
||||
private Coroutine m_graceCoroutine;
|
||||
|
||||
// ── 张开手 StaticHandGesture ────────────────────────────────
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (cam == null) cam = Camera.main;
|
||||
|
||||
}
|
||||
|
||||
public void OnOpenHandDetected()
|
||||
{
|
||||
// 取消正在倒计时的宽限期
|
||||
@@ -26,6 +32,7 @@ public class QuadCatchCtr : MonoBehaviour
|
||||
StopCoroutine(m_graceCoroutine);
|
||||
m_graceCoroutine = null;
|
||||
}
|
||||
Debug.Log("张开手检测到");
|
||||
m_isReady = true;
|
||||
}
|
||||
|
||||
@@ -47,19 +54,22 @@ public class QuadCatchCtr : MonoBehaviour
|
||||
|
||||
public void OnFistDetected()
|
||||
{
|
||||
Debug.Log("握拳面向字检测到");
|
||||
if (!m_isReady || m_isCatching) return;
|
||||
|
||||
Debug.Log("摄像机没找到");
|
||||
// 相机视线射线验证
|
||||
Camera cam = Camera.main;
|
||||
|
||||
Ray ray = new Ray(cam.transform.position, cam.transform.forward);
|
||||
|
||||
if (!Physics.Raycast(ray, out RaycastHit hit, rayLength, detectionLayer))
|
||||
return;
|
||||
|
||||
string hitName = hit.collider.gameObject.name;
|
||||
Debug.Log("抓取到了文字的名称为11111" + hitName);
|
||||
if (hitName.Length < 5 || hitName.Substring(0, 4) != "Quad") return;
|
||||
Debug.Log("抓取到了文字的版块为222222:" + hitName);
|
||||
if (!int.TryParse(hitName.Substring(4), out int fontIndex)) return;
|
||||
|
||||
Debug.Log("抓取到了文字");
|
||||
m_isCatching = true;
|
||||
GlobalEventMgr.Dispatch(GameEvent.EventRayQuadOk, true, 2, fontIndex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user