了解 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 的常见问题。
我们的新闻稿、媒体资料工具包和联系方式。
After setting up the project, we spawn and persist objects inside the domain.
[SerializeField] private ARRaycastManager raycastManager; [SerializeField] private Button createCubeButton;
private List<ARRaycastHit> _arRaycastHits = new List<ARRaycastHit>();
Update()^
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)); } }
PlaceCube()^
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); }
OnCubeButtonClick()
private void OnCubeButtonClick() { var color = Random.ColorHSV(); // Place the cube where the cube marker is PlaceCube(cube.transform.position, cube.transform.rotation, color); }
Random^
using Random = UnityEngine.Random;
Start()^
createCubeButton^
OnCubeButtonClick()^
private void Start() { ... _manna.OnLighthouseTracked += OnLighthouseTracked; ~~ createCubeButton.onClick.AddListener(OnCubeButtonClick); ~~ _conjureKit.Connect(); }
In this sample project we'll save data about the spawned cubes in the device's local storage in JSON format. Because Unity-specific data types like ^Vector3^, ^Quaternion^, and ^Color^ are not inherently serializable into JSON format, we'll introduce the custom serializable classes ^SerializableVector3^, ^SerializableQuaternion^, and ^SerializableColor^, to be used when converting to and from JSON format.
Vector3^
Quaternion^
Color^
SerializableVector3^
SerializableQuaternion^
SerializableColor^
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); }
PersistentARinDomain.cs^
SaveData^
private SaveData _saveData = new SaveData();
SaveLocally()^
_saveData^
PlayerPrefs^
private void SaveLocally() { var json = JsonUtility.ToJson(_saveData); PlayerPrefs.SetString("_saveData", json); PlayerPrefs.Save(); }
LoadLocally()^
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()); } }
private void OnCubeButtonClick() { ... 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(); ~~ }
OnLighthouseTracked()^
private void OnLighthouseTracked(Lighthouse lighthouse, Pose qrPose, bool isCalibrationGood) { ... if(!_calibrated) { _calibrated = true; calibrateUI.SetActive(false); cube.SetActive(true); ~~ LoadLocally(); ~~ } } }
The last step is to assign the references to the AR Camera, Cube, Calibrate UI, Raycast Manager, and Create Cube button in the Unity Editor by dragging and dropping the GameObjects into the script's corresponding serialized fields.
Now when you build and run the project, you should be able to calibrate into a domain, place cubes in it, and have them persist across sessions.
申请 AUKI 代币补助金以启动您的项目,并直接与 Auki Labs 团队合作,将您的创意推向市场。成功申请者可获得价值高达 10 万美元的 AUKI 代币,以及 Auki Labs 团队提供的开发和营销支持。