【m】添加图像识别
This commit is contained in:
@@ -4,15 +4,19 @@ using Rokid.UXR.Interaction;
|
||||
using Stary.Evo;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo.RKTools
|
||||
{
|
||||
public static class RKAddInteractionExtension
|
||||
{
|
||||
#region 触摸
|
||||
|
||||
/// <summary>
|
||||
/// 添加触摸事件
|
||||
/// </summary>
|
||||
/// <param name="Touchedobject">被触碰物体</param>
|
||||
/// <param name="TouchEvent">触碰后事件</param>
|
||||
public static void ObjectAddTouchEvent(this GameObject Touchedobject, System.Action<GameObject> TouchEvent, float TouchScale = 1.2f)
|
||||
public static void ObjectAddTouchEvent(this GameObject Touchedobject, System.Action<GameObject> TouchEvent,
|
||||
float TouchScale = 1.2f)
|
||||
{
|
||||
Collider ObjectCollider = Touchedobject.GetComponent<Collider>();
|
||||
GrabInteractable GrabInteractable = Touchedobject.GetComponent<GrabInteractable>();
|
||||
@@ -84,7 +88,8 @@ public static class RKAddInteractionExtension
|
||||
/// </summary>
|
||||
/// <param name="Dragedobject">被拖动物体</param>
|
||||
/// <param name="DragingEvent">拖动时执行的方法</param>
|
||||
public static void objectAddDrag(this GameObject Dragedobject, System.Action<GameObject> DragingEvent = null, float DragScale = 1.2f)
|
||||
public static void objectAddDrag(this GameObject Dragedobject, System.Action<GameObject> DragingEvent = null,
|
||||
float DragScale = 1.2f)
|
||||
{
|
||||
Collider ObjectCollider = Dragedobject.GetComponent<Collider>();
|
||||
GrabInteractable GrabInteractable = Dragedobject.GetComponent<GrabInteractable>();
|
||||
@@ -149,6 +154,8 @@ public static class RKAddInteractionExtension
|
||||
Object.Destroy(GrabInteractable);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Rokid.UXR.Interaction;
|
||||
|
||||
namespace Stary.Evo.RKTools
|
||||
{
|
||||
public abstract class GestureBase : MonoBehaviour
|
||||
{
|
||||
private GestureBean leftBean = null;
|
||||
@@ -126,3 +128,4 @@ public abstract class GestureBase : MonoBehaviour
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Stary.Evo;
|
||||
|
||||
namespace Stary.Evo.RKTools
|
||||
{
|
||||
public interface IVoiceCommandSystem : ISystem
|
||||
{
|
||||
public void AddVoiceCommand(string content, string spell, Action action);
|
||||
@@ -14,6 +16,7 @@ public interface IVoiceCommandSystem : ISystem
|
||||
public class VoiceCommandSystem : AbstractSystem, IVoiceCommandSystem
|
||||
{
|
||||
private VoiceCommandController _voiceController;
|
||||
|
||||
protected virtual string ControllerName
|
||||
{
|
||||
get { return "VoiceCommandController"; }
|
||||
@@ -26,6 +29,7 @@ public class VoiceCommandSystem : AbstractSystem,IVoiceCommandSystem
|
||||
{
|
||||
VoiceControllerObject = new GameObject(ControllerName);
|
||||
}
|
||||
|
||||
_voiceController = VoiceControllerObject.GetComponent<VoiceCommandController>();
|
||||
if (_voiceController == null)
|
||||
{
|
||||
@@ -52,6 +56,7 @@ public class VoiceCommandSystem : AbstractSystem,IVoiceCommandSystem
|
||||
GameObject.Destroy(_voiceController.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
ClearAllVoiceCommands();
|
||||
@@ -62,3 +67,4 @@ public class VoiceCommandSystem : AbstractSystem,IVoiceCommandSystem
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,8 @@ using Stary.Evo;
|
||||
using Rokid.UXR.Module;
|
||||
using UnityEngine.Android;
|
||||
|
||||
namespace Stary.Evo.RKTools
|
||||
{
|
||||
public class VoiceCommandController : MonoBehaviour
|
||||
{
|
||||
public Dictionary<string, Action> VoiceCommands = new Dictionary<string, Action>();
|
||||
@@ -51,7 +53,9 @@ public class VoiceCommandController : MonoBehaviour
|
||||
Debug.LogError($"语音命令 :“'{content}' ”已经注册了!!!");
|
||||
return;
|
||||
}
|
||||
OfflineVoiceModule.Instance.AddInstruct(LANGUAGE.CHINESE, content, spell, this.gameObject.name, "OnReceive");
|
||||
|
||||
OfflineVoiceModule.Instance.AddInstruct(LANGUAGE.CHINESE, content, spell, this.gameObject.name,
|
||||
"OnReceive");
|
||||
OfflineVoiceModule.Instance.Commit();
|
||||
}
|
||||
|
||||
@@ -90,3 +94,4 @@ public class VoiceCommandController : MonoBehaviour
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/07.RKTools/RunTime/TrackedImage.meta
Normal file
3
Assets/07.RKTools/RunTime/TrackedImage.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef115ccabf224be8a3f28036d2f0b488
|
||||
timeCreated: 1747635144
|
||||
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Rokid.UXR.Module;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo.RKTools
|
||||
{
|
||||
public class TrackedImageEvoManager : ARTrackedImageManager
|
||||
{
|
||||
[TableList] public List<TarkedImageEvoData> TrackedImages;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
TrackedImages = new List<TarkedImageEvoData>();
|
||||
}
|
||||
|
||||
public TarkedImageEvoData GetTrackedImageEvoData(int imageIndex)
|
||||
{
|
||||
foreach (var imageEvoData in TrackedImages)
|
||||
{
|
||||
if (imageEvoData.imageIndex == imageIndex)
|
||||
{
|
||||
return imageEvoData;
|
||||
}
|
||||
}
|
||||
Debug.LogError($"StaryEvo:未找到对应的图片的id数据,请检查是否进行前置识别 index:{imageIndex}");
|
||||
return null;
|
||||
}
|
||||
|
||||
public void SetTrackedImageEvoData(int imageIndex, Transform transform)
|
||||
{
|
||||
foreach (var imageEvoData in TrackedImages)
|
||||
{
|
||||
if (imageEvoData.imageIndex == imageIndex)
|
||||
{
|
||||
imageEvoData.position = transform.position;
|
||||
imageEvoData.rotation = transform.eulerAngles;
|
||||
imageEvoData.scale = transform.localScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TarkedImageEvoData GetTrackedImageEvoData(string domain)
|
||||
{
|
||||
foreach (var imageEvoData in TrackedImages)
|
||||
{
|
||||
if (imageEvoData.domain == domain)
|
||||
{
|
||||
return imageEvoData;
|
||||
}
|
||||
}
|
||||
Debug.LogError($"StaryEvo:未找到对应的domain的id数据,请检查是否进行前置识别 domain:{domain}");
|
||||
return null;
|
||||
}
|
||||
|
||||
public void SetTrackedImageEvoData(string domain, Transform transform)
|
||||
{
|
||||
foreach (var imageEvoData in TrackedImages)
|
||||
{
|
||||
if (imageEvoData.domain == domain)
|
||||
{
|
||||
imageEvoData.position = transform.position;
|
||||
imageEvoData.rotation = transform.eulerAngles;
|
||||
imageEvoData.scale = transform.localScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class TarkedImageEvoData
|
||||
{
|
||||
[VerticalGroup("key")] public string domain;
|
||||
[VerticalGroup("key")] public int imageIndex;
|
||||
|
||||
[VerticalGroup("transform")] public Vector3 position;
|
||||
[VerticalGroup("transform")] public Vector3 rotation;
|
||||
[VerticalGroup("transform")] public Vector3 scale;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be33290f8aa3440cac3e24a68606958b
|
||||
timeCreated: 1747635178
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.staryevo.rktools",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"displayName": "07.RKTools",
|
||||
"description": "Rokid工具",
|
||||
"unity": "2021.3",
|
||||
@@ -15,6 +15,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"com.rokid.xr.unity":"3.0.3",
|
||||
"com.staryevo.main":"1.x.x"
|
||||
"com.staryevo.main":"1.x.x",
|
||||
"com.rokid.xr.extension":"x.x.x"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user