Is it possible to use custom markers?

前端 未结 2 1788
情话喂你
情话喂你 2020-12-07 01:52

Is it possible to use bespoke markers that do not resemble the \"Hiro\" marker like below. Could I potentially use a random shape (a solid red oval for example) as a marker?

2条回答
  •  庸人自扰
    2020-12-07 02:20

    1. preset="pattern"

    Firstly, if you look at the raw js script: https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js, you'll notice there is no preset="custom" in the else if. For example, search else if( _this.data.preset === 'kanji' ){.

    There is however a preset="pattern". So ignore the documentation and set preset="pattern" For example:

    2. Upload .patt to your GitHub so it can resolve the file

    Secondly, my .patt wasn't being picked up locally, so url="img/pattern-marker.patt" may not work. Push this .patt file up to GitHub and then reference it using the raw.githubusercontent.

    Example

    You can test this using my pattern. https://raw.githubusercontent.com/lbelfield/augmented-reality/master/src/components/trainTicket/train-ticket.patt.

    The image of the marker is below: https://github.com/lbelfield/augmented-reality/blob/master/src/components/trainTicket/train-ticket.png

    React-Web-AR: This won't be applicable for you, but if anyone is using React-Web-AR like myself, use this:

提交回复
热议问题