了解 Auki 网络和代币经济的基本原理
在 Auki 网络的支持下,获取自己的领域。
深入了解Auki网络白皮书的细节
在Uniswap DEX上交易$AUKI
在MEXC CEX上交易$AUKI
在Aerodrome DEX上交易$AUKI
实时跟踪 Auki 网络的网络状况。
See how the Auki network is empowering robot fleets.
See how the Auki network is enabling AI.
See how the Auki network is enabling XR experiences.
使用ConjureKit,构建第一代社交增强现实体验。
申请高达 100,000 美元 Auki 代币的开发者补助金
了解如何在 posemesh 上使用我们的 SDK 构建应用程序。
所有 ConjureKit SDK 文档和支援。
了解 Cactus 如何提高零售效率。
了解 Gotu 如何协助物业经理工作。
了解 Gotu 导航如何提升您的活动体验。
零售行业的空间人工智能平台。
为活动和物业提供室内导航。
家庭和展览装饰应用。
通过这个同时多人共享的AR体验,让您大获全胜。
看看谁在与Auki一起搭建 posemesh。
深入了解我们的理念。
加入 Discord 对话。
通过 X 随时了解 Auki 社区的最新动态。
Stay up to date with the Auki community on X.
关于 Auki 和 posemesh 的常见问题。
我们的新闻稿、媒体资料工具包和联系方式。
This is where the magic happens. Implement hand gesture detection and hand interaction with the pet.
In the Animator Controller, create a new Trigger parameter and name it after the action you want the pet to do when it detects a specific hand gesture.
Add this animation and make a transition to it from "Any State." In this transition, add a condition that checks if the Trigger parameter is true.
In ^Main.cs^, add these variables:
Main.cs^
public bool hasPlayedDead = false; private GameObject raccoonObject; private Animator raccoonAnimator;
Add a new function that finds the spawned pet and triggers the animation:
public void PlayDead() { hasPlayedDead = true; raccoonObject = GameObject.Find("Raccoon Cub PA(Clone)"); raccoonAnimator = raccoonObject.GetComponent<Animator>(); raccoonAnimator.SetTrigger("PlayDead"); }
Create a new ^Vector3^ called ^handLandmarksPositions^:
Vector3^
handLandmarksPositions^
private Vector3[] handLandmarksPositions;
Define it in the ^Start()^ function:
Start()^
handLandmarksPositions = new Vector3[HandTracker.LandmarksCount];
In ^_handTracker.OnUpdate^, replace ^var landMarkPosition^ and ^landMarkPosition^ with ^handLandmarksPositions[l]^:
_handTracker.OnUpdate^
var landMarkPosition^
landMarkPosition^
handLandmarksPositions[l]^
for (int l = 0; l < HandTracker.LandmarksCount; ++l) { handLandmarksPositions[l] = new Vector3( landmarks[handLandmarkIndex + (l * 3) + 0], landmarks[handLandmarkIndex + (l * 3) + 1], landmarks[handLandmarkIndex + (l * 3) + 2]); // Update the landmarks position _handLandmarks[l].transform.localPosition = handPosition + handLandmarksPositions[l]; }
In order to detect a gesture, measure the distances between relevant hand landmarks and call the function that triggers the animation when conditions for that hand gesture are met:
var indexPalmDistance = Vector3.Distance(handLandmarksPositions[8], handLandmarksPositions[0]); var middlePalmDistance = Vector3.Distance(handLandmarksPositions[12], handLandmarksPositions[0]); var ringPalmDistance = Vector3.Distance(handLandmarksPositions[16], handLandmarksPositions[0]); var pinkyPalmDistance = Vector3.Distance(handLandmarksPositions[20], handLandmarksPositions[0]); if (indexPalmDistance > 0.1f && middlePalmDistance < 0.08f && ringPalmDistance < 0.08f && pinkyPalmDistance < 0.08f) { if (!hasPlayedDead) { PlayDead(); } }
Now when you build and run the project, the animation should be triggered when the correct hand gesture is detected.
To have the pet perform a different animation when the hand interacts with it, add a second Trigger to the Animator Controller and name it after the action. Like before, add this animation and make a transition to it from "Any State." In this transition, add a condition that checks if the second Trigger parameter is true.
In ^Main.cs^, create a Renderer called ^FingertipLandmark^. This will be used to detect when the hand touches the pet.
FingertipLandmark^
[SerializeField] private Renderer fingertipLandmark;
In ^_handTracker.OnUpdate^, set ^fingertipLandmark^’s position to be at the tip of the index finger:
fingertipLandmark^
fingertipLandmark.transform.localPosition = handPosition + handLandmarksPositions[8];
Below ^_handTracker.OnUpdate^, set ^fingertipLandmark^’s parent to be ^arCamera.transform^:
arCamera.transform^
fingertipLandmark.transform.parent = arCamera.transform;
Now create a second function that triggers the second animation:
public void GetUp() { hasPlayedDead = false; raccoonObject = GameObject.Find("Raccoon Cub PA(Clone)"); raccoonAnimator = raccoonObject.GetComponent<Animator>(); raccoonAnimator.SetTrigger("GetUp"); }
In Unity, create a sphere GameObject which will be the fingertip landmark. Scale it down to 5cm and check “Is Trigger” in the collider component. Drag this fingertip landmark sphere into its field in the Main GameObject.
In the digital pet prefab, add a Rigidbody component so it can get triggers from other colliders, and check “Is Kinematic”.
Now create a new C# script to handle trigger events on the digital pet. Give it a name, for example ^TouchableByHand.cs^. Make sure it’s in the same namespace as ^Main.cs^ and delete the ^Start()^ and ^Update()^ functions.
TouchableByHand.cs^
Update()^
using System.Collections; using System.Collections.Generic; using UnityEngine; namespace AukiHandTrackerSample { public class TouchableByHand : MonoBehaviour { } }
Create the following variables:
public Main mainScript; private GameObject raccoonObject; private Animator raccoonAnimator;
In the ^Awake() ^function, find object of type ^Main^ and assign it to ^mainScript^:
Awake()
Main^
mainScript^
private void Awake() { mainScript = FindObjectOfType<Main>(); }
Define the ^OnTriggerEnter()^ function which will trigger the second animation when the fingertip landmark touches the pet:
OnTriggerEnter()^
private void OnTriggerEnter(Collider other) { if (mainScript == null) { mainScript = FindObjectOfType<Main>(); if (mainScript == null) { Debug.LogError("Main script not found"); return; } } if (mainScript.hasPlayedDead) { mainScript.GetUp(); } }
In Unity, add ^TouchableByHand.cs^ to the digital pet prefab.
Now when you build and run the project, the second animation should be triggered when the fingertip landmark touches the pet.
Hide the hand landmarks by opening the hand landmark prefab and unchecking it. Similarly, hide the sphere on the index finger by unchecking its mesh renderer.
To add occlusion culling, go to the AR Camera and add an AR Occlusion Manager component. Set both of the Human Segmentation settings to "Fastest."
Lastly, remove the spawn button after the pet has spawned by adding this line at the end of the ^CreateRaccoon()^ function:
^CreateRaccoon()^
GameObject.Find("SpawnButton").SetActive(false);
That’s it! Now you have an AR pet that responds to hand gestures and hand interactions.
申请 AUKI 代币补助金以启动您的项目,并直接与 Auki Labs 团队合作,将您的创意推向市场。成功申请者可获得价值高达 10 万美元的 AUKI 代币,以及 Auki Labs 团队提供的开发和营销支持。