Health/Assets/Scripts/PoseCheck/HeadTurnLeft.cs

30 lines
754 B
C#

using OpenCVForUnity.CoreModule;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HeadTurnLeft : PoseBase
{
private bool _isRunning = false;
public override bool CheckPose(List<Point> points)
{
if (!CheckPoint(points, "Nose"))
return false;
//左转头检测
if (CheckPoint(points, "LEar") && !CheckPoint(points, "REar"))
{
return true;
}
if (Math.Abs(points[YogaConfig.BODY_PARTS["LEar"]].x - points[YogaConfig.BODY_PARTS["Nose"]].x) > Math.Abs(points[YogaConfig.BODY_PARTS["REar"]].x - points[YogaConfig.BODY_PARTS["Nose"]].x))
{
return true;
}
return false;
}
}