[英]How to create custom marker in Ar.js?
I Was wondering how things work in Ar.js , But i was stuck with creating custom Markers and custom shapes , is there any way to customize things.我想知道 Ar.js 是如何工作的,但我一直在创建自定义标记和自定义形状,有什么方法可以自定义东西。
this is What i have got things to getting started.这就是我要开始的事情。
<script src="https://aframe.io/releases/0.6.0/aframe.min.js"></script>
<!-- include ar.js for A-Frame -->
<script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js"></script>
<body style='margin : 0px; overflow: hidden;'>
<a-scene embedded arjs>
<!-- create your content here. just a box for now -->
<a-box position='0 0.5 0' material='opacity: 0.5;'></a-box>
<!-- define a camera which will move according to the marker position -->
<a-marker-camera preset='hiro'></a-marker-camera>
</a-scene>
</body>
This is simple example for getting started这是入门的简单示例
You can use the marker generator .您可以使用标记生成器。
In the marker generator在标记生成器中
Upload your image .上传您的图片。
Download the trained marker.下载经过训练的标记。
Include it in your Code.将其包含在您的代码中。
The trained marker is contained in a .patt
file.经过训练的标记包含在
.patt
文件中。 This file contains the encoded marker that you should reuse in your code.此文件包含您应该在代码中重用的编码标记。 You specify you want a pattern marker and you provide the URL to your own marker.
您指定您想要一个模式标记,并提供指向您自己的标记的 URL。 So just replace this in your code.
所以只需在您的代码中替换它。
<a-marker-camera preset='custom' type='pattern' url='assets/NAME-OF-PATTERN-FILE.patt'></a-marker-camera>
You will need to create & specify a custom pattern file.您将需要创建并指定一个自定义模式文件。 See Is it possible to use bespoke markers?
请参阅是否可以使用定制标记?
You should also remove the hiro preset.您还应该删除 hiro 预设。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.