-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emit events when a marker is found and lost, when using aframe's <a-marker> #303
Conversation
…vents when a marker is found and when it is lost.
…nts' property. Add a link to the example of its usage.
@NikolayMihaylov this is great! How can I download this branch to use in my project? |
Hey @peterlunglum, You can download my forked version Keep in mind that this pull request has already diverged a lot with the original repository, so by choosing to use my forked version, you won't be getting other improvements or bugfixes for AR.js. The proper solution would be to get this pull request merged to the main repository. I do not know what its maintainers think about my changes though. |
@NikolayMihaylov A really great job! I just tried it and it works really well with
Am I doing something wrong or is just that custom markers are not supported on your branch? Update: when you apply this commit to your branch it works perfectly :) |
This brings nikolaymihaylov/AR.js/dev up-to-date with the original branch jeromeetienne/AR.js/dev
Hey, there is an ongoing effort to sync this branch with the latest We have an issue with it though. If someone has time to take a look, your help is appreciated! |
+1 on this :-) |
@NikolayMihaylov can you please resolve conflicts first? |
@NikolayMihaylov the PR I have to your branch (which does not have these merge conflicts) now works as expected. If you merge my PR to your branch, this PR should be ready for merging |
@MaesterChestnut and @NikolayMihaylov this is a big feature in my opinion. What needs to be done to make this ready to merge? |
@NikolayMihaylov please my PR into yours or else I'll need to open a separate PR for this feature |
The branch in this pull request is now brought up-to-date. Thanks again @MaesterChestnut for your effort in the pull request https://github.com/nikolaymihaylov/AR.js/pull/1 I have now excluded the build files from the pull request, which will hopefully make this easier to merge. That means that for anyone using my latest If anyone has based their applications on this pull request, you can still use the tag |
Can someone tests this? This is a great feature that solves several issues |
I hope this branch be merged. But while it is not, there is a short solution is: At your HTML:
Create a method to verify the marker state:
At some point start your verification:
|
Any plans to test and merge this pull request? It seems pretty robust and it'll do wonders for making AR.js more useful. |
HI @NikolayMihaylov, I will test it myself. I only ask you if you can give me a builded version of your AR.js so I can directly import it on my example and test it. Something like: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks a lot for your contributions @NikolayMihaylov, im making comments here but you dont have to do it. i can do the modification myself after the merge
@@ -34,6 +34,12 @@ AFRAME.registerComponent('arjs-anchor', { | |||
type: 'number', | |||
default: 0.6, | |||
}, | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(thanks a lot for your contributions @NikolayMihaylov, im making comments here but you dont have to do it. i can do the modification myself after the merge)
this seems harmless to emit the event. it is a rare event so no performance impact. we can remove this options for the sake of simplicity
}else if( !_this.el.object3D.visible && wasVisible ){ | ||
_this.el.emit('markerLost') | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice standalone trick!
what about the 'cameraTransformMatrix' case tho ?
@@ -212,6 +227,7 @@ AFRAME.registerPrimitive('a-marker', AFRAME.utils.extendDeep({}, AFRAME.primitiv | |||
'preset': 'arjs-anchor.preset', | |||
'minConfidence': 'arjs-anchor.minConfidence', | |||
'markerhelpers': 'arjs-anchor.markerhelpers', | |||
'emitevents': 'arjs-anchor.emitevents', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be removed, as seen above
Emit events when a marker is found and lost, when using aframe's <a-marker>
What kind of change does this PR introduce?
New feature
Can it be referenced to an Issue? If so what is the issue # ?
#217
How can we test it?
Check the
aframe/examples/marker-events.html
that I created.Summary
When an
<a-marker>
is found or lost, there is currently no event emitted (as far as I know), to "the outside world". In other words, currently an application that is using AR.js cannot react to the marker becoming visible or invisible.With my addition,
markerFound
andmarkerLost
events will be emitted when the marker changes itsvisible
state. The events are only emitted for<a-marker>
elements which haveemitevents='true'
set.emitevents
defaults tofalse
, so there will be no additional events emitted for any of the existing users of the AR.js library.Does this PR introduce a breaking change?
No.
Other information
I also created a new build, and updated someREADME
andCHANGELOG
files. If these should be excluded from the pull request, let me know and I could make the adjustments.EDIT: The build files are no longer included in this pull request.