bugfix
This commit is contained in:
parent
a2437a89c9
commit
1a0b118da1
|
@ -130145,7 +130145,7 @@ AnimationClip:
|
||||||
intParameter: 0
|
intParameter: 0
|
||||||
messageOptions: 0
|
messageOptions: 0
|
||||||
- time: 41.133335
|
- time: 41.133335
|
||||||
functionName: PlayCountDownSE
|
functionName: ActionBackStart
|
||||||
data:
|
data:
|
||||||
objectReferenceParameter: {fileID: 0}
|
objectReferenceParameter: {fileID: 0}
|
||||||
floatParameter: 0
|
floatParameter: 0
|
||||||
|
|
|
@ -183949,21 +183949,21 @@ AnimationClip:
|
||||||
intParameter: 1
|
intParameter: 1
|
||||||
messageOptions: 0
|
messageOptions: 0
|
||||||
- time: 1.2333333
|
- time: 1.2333333
|
||||||
functionName: ActionHold
|
functionName: ActionRecheck
|
||||||
data:
|
data:
|
||||||
objectReferenceParameter: {fileID: 0}
|
objectReferenceParameter: {fileID: 0}
|
||||||
floatParameter: 0
|
floatParameter: 0
|
||||||
intParameter: 1
|
intParameter: 1
|
||||||
messageOptions: 0
|
messageOptions: 0
|
||||||
- time: 2.9
|
- time: 2.9333334
|
||||||
functionName: StartSampling
|
functionName: PlayCountDownSE
|
||||||
data:
|
data:
|
||||||
objectReferenceParameter: {fileID: 0}
|
objectReferenceParameter: {fileID: 0}
|
||||||
floatParameter: 0
|
floatParameter: 0
|
||||||
intParameter: 0
|
intParameter: 0
|
||||||
messageOptions: 0
|
messageOptions: 0
|
||||||
- time: 3.1333334
|
- time: 3.1333334
|
||||||
functionName: PlayCountDownSE
|
functionName: StartSampling
|
||||||
data:
|
data:
|
||||||
objectReferenceParameter: {fileID: 0}
|
objectReferenceParameter: {fileID: 0}
|
||||||
floatParameter: 0
|
floatParameter: 0
|
||||||
|
@ -183990,13 +183990,6 @@ AnimationClip:
|
||||||
floatParameter: 0
|
floatParameter: 0
|
||||||
intParameter: 0
|
intParameter: 0
|
||||||
messageOptions: 0
|
messageOptions: 0
|
||||||
- time: 6.5666666
|
|
||||||
functionName: ActionHold
|
|
||||||
data:
|
|
||||||
objectReferenceParameter: {fileID: 0}
|
|
||||||
floatParameter: 0
|
|
||||||
intParameter: 12
|
|
||||||
messageOptions: 0
|
|
||||||
- time: 6.8
|
- time: 6.8
|
||||||
functionName: ActionBackStart
|
functionName: ActionBackStart
|
||||||
data:
|
data:
|
||||||
|
@ -184004,13 +183997,6 @@ AnimationClip:
|
||||||
floatParameter: 0
|
floatParameter: 0
|
||||||
intParameter: 0
|
intParameter: 0
|
||||||
messageOptions: 0
|
messageOptions: 0
|
||||||
- time: 9.766666
|
|
||||||
functionName: ActionHold
|
|
||||||
data:
|
|
||||||
objectReferenceParameter: {fileID: 0}
|
|
||||||
floatParameter: 0
|
|
||||||
intParameter: 0
|
|
||||||
messageOptions: 0
|
|
||||||
- time: 10.3
|
- time: 10.3
|
||||||
functionName: Evaluate
|
functionName: Evaluate
|
||||||
data:
|
data:
|
||||||
|
@ -184025,8 +184011,22 @@ AnimationClip:
|
||||||
floatParameter: 0
|
floatParameter: 0
|
||||||
intParameter: 0
|
intParameter: 0
|
||||||
messageOptions: 0
|
messageOptions: 0
|
||||||
|
- time: 16.466667
|
||||||
|
functionName: StartSampling
|
||||||
|
data:
|
||||||
|
objectReferenceParameter: {fileID: 0}
|
||||||
|
floatParameter: 0
|
||||||
|
intParameter: 0
|
||||||
|
messageOptions: 0
|
||||||
|
- time: 17.733334
|
||||||
|
functionName: EndSampling
|
||||||
|
data:
|
||||||
|
objectReferenceParameter: {fileID: 0}
|
||||||
|
floatParameter: 0
|
||||||
|
intParameter: 0
|
||||||
|
messageOptions: 0
|
||||||
- time: 18.1
|
- time: 18.1
|
||||||
functionName: ActionHold
|
functionName: ActionRecheck
|
||||||
data:
|
data:
|
||||||
objectReferenceParameter: {fileID: 0}
|
objectReferenceParameter: {fileID: 0}
|
||||||
floatParameter: 0
|
floatParameter: 0
|
||||||
|
@ -184103,7 +184103,7 @@ AnimationClip:
|
||||||
intParameter: 1
|
intParameter: 1
|
||||||
messageOptions: 0
|
messageOptions: 0
|
||||||
- time: 34.433334
|
- time: 34.433334
|
||||||
functionName: ActionHold
|
functionName: ActionRecheck
|
||||||
data:
|
data:
|
||||||
objectReferenceParameter: {fileID: 0}
|
objectReferenceParameter: {fileID: 0}
|
||||||
floatParameter: 0
|
floatParameter: 0
|
||||||
|
@ -184180,7 +184180,7 @@ AnimationClip:
|
||||||
intParameter: 0
|
intParameter: 0
|
||||||
messageOptions: 0
|
messageOptions: 0
|
||||||
- time: 51.166668
|
- time: 51.166668
|
||||||
functionName: ActionHold
|
functionName: ActionRecheck
|
||||||
data:
|
data:
|
||||||
objectReferenceParameter: {fileID: 0}
|
objectReferenceParameter: {fileID: 0}
|
||||||
floatParameter: 0
|
floatParameter: 0
|
||||||
|
|
|
@ -15,15 +15,15 @@ public class LeftLateralHead : PoseBase
|
||||||
var pointList = points.OrderBy(p => p.Item1);
|
var pointList = points.OrderBy(p => p.Item1);
|
||||||
var startP = points.First().Item2;
|
var startP = points.First().Item2;
|
||||||
var endP = points.Last().Item2;
|
var endP = points.Last().Item2;
|
||||||
|
//"REye", "LEye"
|
||||||
var startDir = "Nose".vector(startP) - "Neck".vector(startP);
|
var startDir = "REye".vector(startP) - "LEye".vector(startP);
|
||||||
var endDir = "Nose".vector(endP) - "Neck".vector(endP);
|
var endDir = "REye".vector(endP) - "LEye".vector(endP);
|
||||||
|
|
||||||
var angle = Vector2.SignedAngle(startDir, endDir);
|
var angle = Vector2.SignedAngle(startDir, endDir);
|
||||||
|
|
||||||
LogPrint.Log($"angle: {angle}", PrintLevel.Normal);
|
LogPrint.Warning($"angle: {angle}", PrintLevel.Normal);
|
||||||
|
|
||||||
if (MathF.Abs(angle) > 10)
|
if (angle > 10)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,15 +106,17 @@ public abstract class PoseBase
|
||||||
|
|
||||||
var vector = GetBasicVectorDirection(p1, p2);
|
var vector = GetBasicVectorDirection(p1, p2);
|
||||||
distance += vector;
|
distance += vector;
|
||||||
if (vector.magnitude > 0.1f) //如果矢量长度大于0.1f,说明有运动
|
//if (vector.magnitude > 0.1f) //如果矢量长度大于0.1f,说明有运动
|
||||||
{
|
//{
|
||||||
TimeSpan timeSpan = points[i + 1].Item1 - points[i].Item1;
|
// TimeSpan timeSpan = points[i + 1].Item1 - points[i].Item1;
|
||||||
|
|
||||||
if (totalTimeSpan == TimeSpan.MinValue)
|
// if (totalTimeSpan == TimeSpan.MinValue)
|
||||||
totalTimeSpan = timeSpan;
|
// totalTimeSpan = timeSpan;
|
||||||
else
|
// else
|
||||||
totalTimeSpan += timeSpan;
|
// totalTimeSpan += timeSpan;
|
||||||
}
|
//}
|
||||||
|
TimeSpan timeSpan = points[i + 1].Item1 - points[i].Item1;
|
||||||
|
totalTimeSpan = timeSpan;
|
||||||
}
|
}
|
||||||
LogPrint.Log($"distance: {distance}, totalTimeSpan: {totalTimeSpan}", PrintLevel.Normal);
|
LogPrint.Log($"distance: {distance}, totalTimeSpan: {totalTimeSpan}", PrintLevel.Normal);
|
||||||
|
|
||||||
|
|
|
@ -15,15 +15,15 @@ public class RightLateralHead : PoseBase
|
||||||
var pointList = points.OrderBy(p => p.Item1);
|
var pointList = points.OrderBy(p => p.Item1);
|
||||||
var startP = points.First().Item2;
|
var startP = points.First().Item2;
|
||||||
var endP = points.Last().Item2;
|
var endP = points.Last().Item2;
|
||||||
|
//"REye", "LEye"
|
||||||
var startDir = "Nose".vector(startP) - "Neck".vector(startP);
|
var startDir = "REye".vector(startP) - "LEye".vector(startP);
|
||||||
var endDir = "Nose".vector(endP) - "Neck".vector(endP);
|
var endDir = "REye".vector(endP) - "LEye".vector(endP);
|
||||||
|
|
||||||
var angle = Vector2.SignedAngle(startDir, endDir);
|
var angle = Vector2.SignedAngle(startDir, endDir);
|
||||||
|
|
||||||
LogPrint.Log($"angle: {angle}", PrintLevel.Normal);
|
LogPrint.Warning($"angle: {angle}", PrintLevel.Normal);
|
||||||
|
|
||||||
if (MathF.Abs(angle) > 10)
|
if (angle < -10)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,9 @@ public class YogaManager : MonoSingleton<YogaManager>
|
||||||
_actions[AvatarAction.HeadTurnDown] = new HeadTurnDown();
|
_actions[AvatarAction.HeadTurnDown] = new HeadTurnDown();
|
||||||
_actions[AvatarAction.HandsUp] = new HandsUp();
|
_actions[AvatarAction.HandsUp] = new HandsUp();
|
||||||
_actions[AvatarAction.HandsDown] = new HandsHold();
|
_actions[AvatarAction.HandsDown] = new HandsHold();
|
||||||
|
_actions[AvatarAction.LeftLateralHead] = new LeftLateralHead();
|
||||||
|
_actions[AvatarAction.RightLateralHead] = new RightLateralHead();
|
||||||
|
_actions[AvatarAction.Hold] = new HoldPosition();
|
||||||
|
|
||||||
_currentCheckPointCount = 0;
|
_currentCheckPointCount = 0;
|
||||||
_currentCheckPointSuccessCount = 0;
|
_currentCheckPointSuccessCount = 0;
|
||||||
|
@ -119,6 +122,8 @@ public class YogaManager : MonoSingleton<YogaManager>
|
||||||
|
|
||||||
EventManager.Instance.AddEventListener(YogaEventType.Action_Success, OnActionSuccess);
|
EventManager.Instance.AddEventListener(YogaEventType.Action_Success, OnActionSuccess);
|
||||||
EventManager.Instance.AddEventListener(YogaEventType.Action_Fail, OnActionFailed);
|
EventManager.Instance.AddEventListener(YogaEventType.Action_Fail, OnActionFailed);
|
||||||
|
EventManager.Instance.AddEventListener(YogaEventType.Action_StartSampling, OnSamplingStart);
|
||||||
|
EventManager.Instance.AddEventListener(YogaEventType.Action_EndSampling, OnSamplingEnd);
|
||||||
EventManager.Instance.AddEventListener(YogaEventType.Action_Evaluate, OnEvaluation);
|
EventManager.Instance.AddEventListener(YogaEventType.Action_Evaluate, OnEvaluation);
|
||||||
//extra event
|
//extra event
|
||||||
EventManager.Instance.AddEventListener(YogaEventType.Action_MoveDistanceExactly, ExtraMoveDistanceExactly);
|
EventManager.Instance.AddEventListener(YogaEventType.Action_MoveDistanceExactly, ExtraMoveDistanceExactly);
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace Yoga
|
||||||
}
|
}
|
||||||
private void GCCollection()
|
private void GCCollection()
|
||||||
{
|
{
|
||||||
if (_isOnCamCapture && enabled == true)
|
if (_isOnCamCapture && enabled == true && gameObject.activeInHierarchy == true)
|
||||||
StartCoroutine(CleanUp());
|
StartCoroutine(CleanUp());
|
||||||
}
|
}
|
||||||
private IEnumerator CleanUp()
|
private IEnumerator CleanUp()
|
||||||
|
|
|
@ -14,20 +14,20 @@ public class YogaDataLoader
|
||||||
data[-1] = new YogaData()
|
data[-1] = new YogaData()
|
||||||
{
|
{
|
||||||
VideoPath = "Video/Action3",
|
VideoPath = "Video/Action3",
|
||||||
Actions = new List<AvatarAction>() { AvatarAction.SitUpright, AvatarAction.SitUpright, AvatarAction.Nod },
|
Actions = new List<AvatarAction>() { AvatarAction.SitUpright, AvatarAction.HeadShake },
|
||||||
Action = AvatarAction.Nod,
|
Action = AvatarAction.Nod,
|
||||||
ModelType = ModelType.OpenPose,
|
ModelType = ModelType.OpenPose,
|
||||||
MaxCheckPointCount = 1000,
|
MaxCheckPointCount = 1000,
|
||||||
TotalSeconds = 20.0f,
|
TotalSeconds = 20.0f,
|
||||||
RectCutRate = 0.2f,
|
RectCutRate = 0.2f,
|
||||||
MustPoints = new List<string>() { "Nose", /*"REye", "LEye", */"Neck" },
|
MustPoints = new List<string>() { "Nose", "Neck" },//{"REye", "LEye"}
|
||||||
//AnyPoints = new List<string>() { "RWrist", "LWrist" }
|
//AnyPoints = new List<string>() { "RWrist", "LWrist" }
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
data[1] = new YogaData()
|
data[1] = new YogaData()
|
||||||
{
|
{
|
||||||
VideoPath = "Video/Action1",
|
VideoPath = "Video/Action1",
|
||||||
Actions = new List<AvatarAction>() { AvatarAction.SitUpright, AvatarAction.SitUpright, AvatarAction.SitUpright, AvatarAction.HeadShake },
|
Actions = new List<AvatarAction>() { AvatarAction.SitUpright, AvatarAction.HeadShake },
|
||||||
Action = AvatarAction.HeadShake,
|
Action = AvatarAction.HeadShake,
|
||||||
ModelType = ModelType.OpenPose,
|
ModelType = ModelType.OpenPose,
|
||||||
MaxCheckPointCount = 4,
|
MaxCheckPointCount = 4,
|
||||||
|
@ -38,6 +38,7 @@ public class YogaDataLoader
|
||||||
data[2] = new YogaData()
|
data[2] = new YogaData()
|
||||||
{
|
{
|
||||||
VideoPath = "Video/Action2",
|
VideoPath = "Video/Action2",
|
||||||
|
Actions = new List<AvatarAction>() { AvatarAction.SitUpright, AvatarAction.Nod },
|
||||||
Action = AvatarAction.Nod,
|
Action = AvatarAction.Nod,
|
||||||
ModelType = ModelType.OpenPose,
|
ModelType = ModelType.OpenPose,
|
||||||
MaxCheckPointCount = 4,
|
MaxCheckPointCount = 4,
|
||||||
|
@ -48,11 +49,12 @@ public class YogaDataLoader
|
||||||
data[3] = new YogaData()
|
data[3] = new YogaData()
|
||||||
{
|
{
|
||||||
VideoPath = "Video/Action3",
|
VideoPath = "Video/Action3",
|
||||||
|
Actions = new List<AvatarAction>() { AvatarAction.SitUpright, AvatarAction.LateralHead },
|
||||||
Action = AvatarAction.LateralHead,
|
Action = AvatarAction.LateralHead,
|
||||||
ModelType = ModelType.MediapipePose,
|
ModelType = ModelType.OpenPose,
|
||||||
MaxCheckPointCount = 4,
|
MaxCheckPointCount = 4,
|
||||||
TotalSeconds = 12.66f,
|
TotalSeconds = 12.66f,
|
||||||
MustPoints = new List<string>() { "Nose", "RShoulder", "LShoulder", "RElbow", "LElbow" }
|
MustPoints = new List<string>() { "REye", "LEye" }
|
||||||
};
|
};
|
||||||
|
|
||||||
if (data.ContainsKey(index))
|
if (data.ContainsKey(index))
|
||||||
|
|
Loading…
Reference in New Issue