Reputation: 8233
I'm using JSARToolkit (https://github.com/artoolkit/jsartoolkit5) on a project. It makes a lot of things easier.
However, I've some trouble when I try to get all markers that have been detected, and their IDs.
I guess something like that...
arController.addEventListener('getMarker', function (e) {
console.log(e.data.marker.id);
});
...would do the job, but whatever marker I put in front of the camera, the ID is 0. When I log e
, I can't find any ID relative to the marker (e.g. https://raw.githubusercontent.com/artoolkit/artoolkit5/master/doc/patterns/Matrix%20code%203x3%20with%20parity%20(72dpi)/1.png : this marker ID should be 1).
Any ideas?
Upvotes: 2
Views: 499
Reputation: 3996
I think you may be confused about the markerId. I know how it works on Unity and Android, so I am assuming it is similar in JS.
The marker ID is a number that gets assigned to a marker when it is loaded, so if you only load one marker, the ID is always 0.
This has no relationship with the matrix code number, which is the one you are looking for.
Also, matrix mode is slightly different than "standard" mode.
I'd say try logging the IDs when the markers are loaded and go on from there.
Upvotes: 0