I'm trying to add distance triggers to an object in my ar-scene, following the code snippet on the project's github page.
The following gives me errors in Argon.
<ar-geopose id="GT2" lla=" -84.398881 33.778463" userotation="false"
trigger="radius:100;event:alert('You are near GT.');">
</ar-geopose>
Am I calling events incorrectly?
(This all assumes you are using argon.js and argon-aframe.js from http://argonjs.io)
The "event" attribute of your trigger needs to be the name of an event you want to generate, not code to execute. The attributes of the components (like trigger) specify parameters (like any CSS attributes), not code.
So, you should use something like this in your javascript
trigger="radius:100;event:target_trigger"
This will cause the trigger component to emit("target_trigger")
on the entity you've attached it to.
You could listen for that by doing something like
var GT = document.querySelector("#GT2");
GT.addEventListener('target_trigger', function(evt) {
alert("you are near GT.");
});
I would avoid using alerts in an AR app, of course, but I assume you're doing this for testing/debugging.