了解 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 的常见问题。
我们的新闻稿、媒体资料工具包和联系方式。
In this chapter we'll cover SDK setup and digital asset spawning.
Install the Ur package, import the sample from Ur, and open the Main scene.
Then Import a digital pet prefab asset of your choice, ideally one that already comes with an animator and a controller.
In the sample's ^Main.cs^ script, add the following imports:
Main.cs^
using Auki.ConjureKit; using Auki.ConjureKit.Manna; using Auki.Util; using UnityEngine.UI; using UnityEngine.XR.ARSubsystems;
Create these variables:
[SerializeField] private Text sessionState; [SerializeField] private Text sessionID; [SerializeField] private GameObject raccoon; [SerializeField] private Button spawnButton; private bool qrCodeBool; [SerializeField] Button qrCodeButton; private IConjureKit _conjureKit; private Manna _manna; private ARCameraManager arCameraManager; private Texture2D _videoTexture;
In the ^Start()^ function, declare the ^arCameraManager^ variable, initialize ^ConjureKit^ (remember to add ^YOUR_APP_KEY^ and ^YOUR_APP_SECRET^), and connect to a Relay server.
Start()^
arCameraManager^
ConjureKit^
YOUR_APP_KEY^
YOUR_APP_SECRET^
arCameraManager = arCamera.GetComponent<ARCameraManager>(); _conjureKit = new ConjureKit( arCamera.transform, "YOUR_APP_KEY", "YOUR_APP_SECRET"); _manna = new Manna(_conjureKit); _conjureKit.OnStateChanged += state => { sessionState.text = state.ToString(); ToggleControlsState(state == State.Calibrated); }; _conjureKit.OnJoined += session => { sessionID.text = session.Id.ToString(); }; _conjureKit.OnLeft += session => { sessionID.text = ""; }; _conjureKit.OnEntityAdded += CreateRaccoon; _conjureKit.Connect();
Feed Manna with AR camera video frames acquired from ^ARCameraManager^ in order to recognize QR codes and perform instant calibration.
ARCameraManager^
private void Update() { _handTracker.Update(); FeedMannaWithVideoFrames(); } private void FeedMannaWithVideoFrames() { var imageAcquired = arCameraManager.TryAcquireLatestCpuImage(out var cpuImage); if (!imageAcquired) { AukiDebug.LogInfo("Couldn't acquire CPU image"); return; } if (_videoTexture == null) _videoTexture = new Texture2D(cpuImage.width, cpuImage.height, TextureFormat.R8, false); var conversionParams = new XRCpuImage.ConversionParams(cpuImage, TextureFormat.R8); cpuImage.ConvertAsync( conversionParams, (status, @params, buffer) => { _videoTexture.SetPixelData(buffer, 0, 0); _videoTexture.Apply(); cpuImage.Dispose(); _manna.ProcessVideoFrameTexture( _videoTexture, arCamera.projectionMatrix, arCamera.worldToCameraMatrix ); } ); }
Delete the ^ToggleHandLandmarks()^ function from the sample code as well as the call to it.
ToggleHandLandmarks()^
Then add the following functions: ^ToggleControlsState()^, ^ToggleLighthouse()^, ^CreateRaccoon()^, and ^CreateRaccoonEntity()^:
ToggleControlsState()^
ToggleLighthouse()^
CreateRaccoon()^
CreateRaccoonEntity()^
private void ToggleControlsState(bool interactable) { if (spawnButton) spawnButton.interactable = interactable; if (qrCodeButton) qrCodeButton.interactable = interactable; } public void ToggleLighthouse() { qrCodeBool = !qrCodeBool; _manna.SetLighthouseVisible(qrCodeBool); } public void CreateRaccoonEntity() { if (_conjureKit.GetState() != State.Calibrated) return; Vector3 position = arCamera.transform.position + arCamera.transform.forward * 0.5f; Quaternion rotation = Quaternion.Euler(0, arCamera.transform.eulerAngles.y, 0); Pose entityPos = new Pose(position, rotation); _conjureKit.GetSession().AddEntity( entityPos, onComplete: entity => CreateRaccoon(entity), onError: error => Debug.Log(error)); } private void CreateRaccoon(Entity entity) { if (entity.Flag == EntityFlag.EntityFlagParticipantEntity) return; var pose = _conjureKit.GetSession().GetEntityPose(entity); Instantiate(raccoon, pose.position, pose.rotation); }
In Unity, create two legacy text objects called ^SessionState^ and ^SessionID^, as well as two buttons called ^SpawnButton^ and ^QR^. Position these on the canvas.
SessionState^
SessionID^
SpawnButton^
QR^
Add an On Click callback for ^SpawnButton^ to ^CreateRaccoonEntity()^; for the ^QR^ button it should be ^ToggleLighthouse()^.
Drag the two text objects and the two buttons to their corresponding fields in the Main GameObject.
Drag the digital pet prefab into its field in the Main GameObject as well and edit or create its animator controller. The default sequence of animations should start at "Entry," transition to the "Default State" and any other animations, and end at "Exit."
Hit the Play button and spawn your pet. If it's facing the wrong direction, adjust its Y axis rotation:
Quaternion rotation = Quaternion.Euler(0, 180, 0);
In order to spawn the pet on a surface, find the AR Plane Manager component inside the AR Session Origin GameObject and change its Detection Mode to "Horizontal".
In the ^CreateRaccoonEntity()^ function, instead of positioning the pet relative to the AR Camera, perform a raycast to the detected plane and spawn the pet where the ray hits the plane:
public void CreateRaccoonEntity() { if (_conjureKit.GetState() != State.Calibrated) return; Ray ray = arCamera.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2)); List<ARRaycastHit> hits = new List<ARRaycastHit>(); if (arRaycastManager.Raycast(ray, hits, TrackableType.PlaneWithinPolygon)) { Quaternion rotation = Quaternion.Euler(0, 180, 0); Pose hitPose = new Pose(hits[0].pose.position, rotation); _conjureKit.GetSession().AddEntity( hitPose, onComplete: entity => CreateRaccoon(entity), onError: error => Debug.Log(error)); } }
If you build and run the project now (remember to add open scenes before building), the app should connect to ConjureKit and the pet should spawn on the floor.
申请 AUKI 代币补助金以启动您的项目,并直接与 Auki Labs 团队合作,将您的创意推向市场。成功申请者可获得价值高达 10 万美元的 AUKI 代币,以及 Auki Labs 团队提供的开发和营销支持。