了解 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 的常见问题。
我们的新闻稿、媒体资料工具包和联系方式。
All of the code for the project can be found below or on GitHub.
^PersistentARinDomain.cs:^:
PersistentARinDomain.cs
using System.Collections; using System.Collections.Generic; using Auki.ConjureKit; using Auki.ConjureKit.Manna; using Auki.Integration.ARFoundation; using UnityEngine; using UnityEngine.UI; using UnityEngine.XR.ARFoundation; using UnityEngine.XR.ARSubsystems; using Random = UnityEngine.Random; public class PersistentARinDomain : MonoBehaviour { [SerializeField] private Camera arCamera; [SerializeField] private GameObject cube; [SerializeField] private GameObject calibrateUI; [SerializeField] private ARRaycastManager raycastManager; [SerializeField] private Button createCubeButton; private const string AppKey = "YOUR_APP_KEY"; private const string AppSecret = "YOUR_APP_SECRET"; private IConjureKit _conjureKit; private Manna _manna; private bool _calibrated = false; private List<ARRaycastHit> _arRaycastHits = new List<ARRaycastHit>(); private SaveData _saveData = new SaveData(); private void Start() { _conjureKit = new ConjureKit( arCamera.transform, AppKey, AppSecret); _manna = new Manna(_conjureKit); var textureProviderComp = CameraFrameProvider.GetOrCreateComponent(); textureProviderComp.OnNewFrameReady += frame => _manna.ProcessVideoFrameTexture(frame.Texture, frame.ARProjectionMatrix, frame.ARWorldToCameraMatrix); _manna.OnLighthouseTracked += OnLighthouseTracked; createCubeButton.onClick.AddListener(OnCubeButtonClick); _conjureKit.Connect(); } private void OnLighthouseTracked(Lighthouse lighthouse, Pose qrPose, bool isCalibrationGood) { // If the QR detection was good enough and the QR code is static (generated from the posemesh console), // hide the calibration view and show the cube marker if (isCalibrationGood && lighthouse.Type == Lighthouse.LighthouseType.Static) { if(!_calibrated) { _calibrated = true; calibrateUI.SetActive(false); cube.SetActive(true); LoadLocally(); } } } private void Update() { // Make a raycast from the center of the screen to an AR plane (floor, wall, or any other surface detected by ARFoundation) var ray = arCamera.ViewportPointToRay(Vector3.one * 0.5f); if (raycastManager.Raycast(ray, _arRaycastHits, TrackableType.PlaneWithinPolygon)) { // Place the cube where the raycast hits a plane. Move it half the cube size along the hit normal (up if on the ground, forward if on the wall) cube.transform.position = _arRaycastHits[0].pose.position + _arRaycastHits[0].pose.up * cube.transform.localScale.x / 2f; // Rotate the cube only around y axis to always face the camera cube.transform.rotation = Quaternion.Euler(Vector3.Scale(arCamera.transform.rotation.eulerAngles, Vector3.up)); } } private void PlaceCube(Vector3 position, Quaternion rotation, Color color) { var placedCube = Instantiate(cube, position, rotation); placedCube.GetComponent<Renderer>().material.color = color; placedCube.gameObject.SetActive(true); } private void OnCubeButtonClick() { var color = Random.ColorHSV(); // Place the cube where the cube marker is PlaceCube(cube.transform.position, cube.transform.rotation, color); // Save the position and rotation information locally _saveData.cubes.Add(new CubeData(cube.transform.position, cube.transform.rotation, color)); SaveLocally(); } private void SaveLocally() { var json = JsonUtility.ToJson(_saveData); PlayerPrefs.SetString("_saveData", json); PlayerPrefs.Save(); } private void LoadLocally() { if(!PlayerPrefs.HasKey("_saveData")) return; var json = PlayerPrefs.GetString("_saveData"); _saveData = JsonUtility.FromJson<SaveData>(json); foreach (var savedCube in _saveData.cubes) { PlaceCube(savedCube.position.ToVector3(), savedCube.rotation.ToQuaternion(), savedCube.color.ToColor()); } } }
^SaveData.cs^:
^SaveData.cs^
using System; using System.Collections.Generic; using UnityEngine; [Serializable] public class SaveData { public List<CubeData> cubes = new List<CubeData>(); } // Because Unity's Vector3, Quaternion and Color structs are not marked as [Serializable] they can't be serialized into JSON. // For that we create serializable versions of each one. There can be other approaches depending on how you serialize/deserialize the data. [Serializable] public class CubeData { public SerializableVector3 position; public SerializableQuaternion rotation; public SerializableColor color; public CubeData() {} public CubeData(Vector3 position, Quaternion rotation, Color color) { this.position = new SerializableVector3(position); this.rotation = new SerializableQuaternion(rotation); this.color = new SerializableColor(color); } } [Serializable] public class SerializableVector3 { public float x, y, z; public SerializableVector3() {} public SerializableVector3(Vector3 sourceVector) { x = sourceVector.x; y = sourceVector.y; z = sourceVector.z; } public Vector3 ToVector3() => new Vector3(x, y, z); } [Serializable] public class SerializableQuaternion { public float x, y, z, w; public SerializableQuaternion() {} public SerializableQuaternion(Quaternion sourceQuaternion) { x = sourceQuaternion.x; y = sourceQuaternion.y; z = sourceQuaternion.z; w = sourceQuaternion.w; } public Quaternion ToQuaternion() => new Quaternion(x, y, z, w); } [Serializable] public class SerializableColor { public float r, g, b, a; public SerializableColor() {} public SerializableColor(Color sourceColor) { r = sourceColor.r; g = sourceColor.g; b = sourceColor.b; a = sourceColor.a; } public Color ToColor() => new Color(r, g, b, a); }
The full project can be found on GitHub.
申请 AUKI 代币补助金以启动您的项目,并直接与 Auki Labs 团队合作,将您的创意推向市场。成功申请者可获得价值高达 10 万美元的 AUKI 代币,以及 Auki Labs 团队提供的开发和营销支持。