Health/Assets/Scripts/PoseCheck/HeadTurnRight.cs

26 lines
685 B
C#

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