修复识别bug

This commit is contained in:
terric 2023-11-13 14:43:34 +08:00
parent 7b0e8a4c1b
commit 03a73c8044
23 changed files with 34 additions and 200 deletions

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: e674b43a45d7dc344b61672a2436ea38
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 933e4b82ad45e0c4d8044e06f93e5758
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 2d0bc0dfb2340e74295d5cfe635f962f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,33 +0,0 @@
fileFormatVersion: 2
guid: d277b1b967c68fb47b5a480fc32cf818
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 1
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings:
CPU: ARM64
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: fe2008c770d630c479ccc4294d2d6fea
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,33 +0,0 @@
fileFormatVersion: 2
guid: 15662e17b2f184547bf67611e96871e9
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 1
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings:
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: c585a80e44222654ba9387bc242b19c7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,33 +0,0 @@
fileFormatVersion: 2
guid: c120e2c80b8a0934bac83fde94bbb0dd
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 1
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings:
CPU: x86
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: f9d73c11ac4922d4dada3ac36e2b66b7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,33 +0,0 @@
fileFormatVersion: 2
guid: 517a05de3eb111b42b0c8bbacdf81a5b
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 1
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings:
CPU: x86_64
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1048,7 +1048,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: df35b0c19ca97734e87299a664cea35f, type: 3} m_Script: {fileID: 11500000, guid: df35b0c19ca97734e87299a664cea35f, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_requestedDeviceName: 2 _requestedDeviceName: 1
_requestedWidth: 1280 _requestedWidth: 1280
_requestedHeight: 960 _requestedHeight: 960
_requestedIsFrontFacing: 0 _requestedIsFrontFacing: 0

View File

@ -5,7 +5,7 @@ public class HandsUp : PoseBase
{ {
public override bool CheckPose(List<Point> points) public override bool CheckPose(List<Point> points)
{ {
// 必须包含 Nose 和 LEar 和 Neck 的点位 // 必须包含 Neck 和 LEar 和 Neck 的点位
if (!YogaManager.Instance.ActionCheckPoints(points)) if (!YogaManager.Instance.ActionCheckPoints(points))
return false; return false;

View File

@ -16,7 +16,7 @@ public class HeadTurnDown : PoseBase
var noseMagnitude = ("Nose".vector(points) - "Neck".vector(points)).magnitude; var noseMagnitude = ("Nose".vector(points) - "Neck".vector(points)).magnitude;
var noseBaseMagnitude = ("Nose".vector(basePoint) - "Neck".vector(basePoint)).magnitude; var noseBaseMagnitude = ("Nose".vector(basePoint) - "Neck".vector(basePoint)).magnitude;
if (noseBaseMagnitude > noseMagnitude) if (noseBaseMagnitude > noseMagnitude * 1.1f)
return true; return true;
return false; return false;

View File

@ -28,8 +28,6 @@ public class HeadTurnLeft : PoseBase
if (Vector2.Dot(headVector, noseVector) > Vector2.Dot(headBaseVector, noseBaseVector) + 0.1f) if (Vector2.Dot(headVector, noseVector) > Vector2.Dot(headBaseVector, noseBaseVector) + 0.1f)
return true; return true;
Debug.LogWarning($"REye point: {"RElbow".vector(points)}, LEye point: {"LElbow".vector(points)}, vector dot:{Vector2.Dot(headVector, noseVector)}");
Debug.LogWarning($"REye base point: {"RElbow".vector(points)}, LEye point: {"LElbow".vector(points)}, vector dot:{Vector2.Dot(headBaseVector, noseBaseVector)}");
return false; return false;
} }

View File

@ -26,9 +26,6 @@ public class HeadTurnRight : PoseBase
if (Vector2.Dot(headVector, noseVector) < Vector2.Dot(headBaseVector, noseBaseVector) - 0.1f) if (Vector2.Dot(headVector, noseVector) < Vector2.Dot(headBaseVector, noseBaseVector) - 0.1f)
return true; return true;
Debug.LogWarning("point:" + Vector2.Dot(headVector, noseVector));
Debug.LogWarning("base point:" + Vector2.Dot(headBaseVector, noseBaseVector));
return false; return false;
} }

View File

@ -16,7 +16,7 @@ public class HeadTurnUp : PoseBase
var noseMagnitude = ("Nose".vector(points) - "Neck".vector(points)).magnitude; var noseMagnitude = ("Nose".vector(points) - "Neck".vector(points)).magnitude;
var noseBaseMagnitude = ("Nose".vector(basePoint) - "Neck".vector(basePoint)).magnitude; var noseBaseMagnitude = ("Nose".vector(basePoint) - "Neck".vector(basePoint)).magnitude;
if (noseBaseMagnitude > noseMagnitude) if (noseBaseMagnitude * 1.1f < noseMagnitude)
return true; return true;
return false; return false;

View File

@ -13,10 +13,11 @@ public class YogaDataLoader
#if UNITY_EDITOR #if UNITY_EDITOR
data[-1] = new YogaDataData() data[-1] = new YogaDataData()
{ {
VideoPath = "Video/Action1", VideoPath = "Video/Action2",
Action = AvatarAction.HeadShake, Action = AvatarAction.Nod,
MaxActionCount = 1000, MaxActionCount = 1000,
MustPoints = new List<string>() { "Nose", "REye", "LEye", "Neck" } MustPoints = new List<string>() { "Nose", "REye", "LEye", "Neck" },
//AnyPoints = new List<string>() { "RWrist", "LWrist" }
}; };
#endif #endif
data[1] = new YogaDataData() data[1] = new YogaDataData()
@ -58,4 +59,5 @@ public class YogaDataData
public AvatarAction Action; public AvatarAction Action;
public int MaxActionCount; public int MaxActionCount;
public List<string> MustPoints = new List<string>(); public List<string> MustPoints = new List<string>();
public List<string> AnyPoints = new List<string>();
} }

View File

@ -113,12 +113,12 @@ public class YogaManager : MonoSingleton<YogaManager>
return false; return false;
} }
//for (int i = 0; i < points.Count; i++) for (int i = 0; i < points.Count; i++)
//{ {
// Point p = points[i]; Point p = points[i];
// if (p != new Point(-1, -1)) if (p != new Point(-1, -1))
// Debug.LogWarning($"ActionPoints p({i}): {i.tagName()}, value: {p.x},{p.y}"); Debug.LogWarning($"ActionPoints p({i}): {i.tagName()}, value: {p.x},{p.y}");
//} }
foreach (var p in Action.MustPoints) foreach (var p in Action.MustPoints)
{ {
@ -128,6 +128,20 @@ public class YogaManager : MonoSingleton<YogaManager>
return false; return false;
} }
} }
//不设的情况下,不检测
if (Action.AnyPoints != null && Action.AnyPoints.Count > 0)
{
foreach (var p in Action.AnyPoints)
{
if (p.IsValid(points)) //有一个点符合 返回true
{
return true;
}
}
return false; //没有一个点符合 返回false
}
return true; return true;
} }
} }

View File

@ -136,7 +136,10 @@ PlayerSettings:
vulkanEnableCommandBufferRecycling: 1 vulkanEnableCommandBufferRecycling: 1
loadStoreDebugModeEnabled: 0 loadStoreDebugModeEnabled: 0
bundleVersion: 0.12 bundleVersion: 0.12
preloadedAssets: [] preloadedAssets:
- {fileID: 11400000, guid: e909ead19248db448b564bc342b7c221, type: 2}
- {fileID: 11400000, guid: 9bb62c82f36383440a845a9a59025c6f, type: 2}
- {fileID: 2671796653090180050, guid: b1802c783fe98e94a9bd4fd13519cef8, type: 2}
metroInputSource: 0 metroInputSource: 0
wsaTransparentSwapchain: 0 wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1 m_HolographicPauseOnTrackingLoss: 1