Closed ToorDev closed 7 months ago
check event.target
@ToorDev if it helps, close please issue
Thank you for your quick response @BostonLeeK. I tried using event.target
, but it doesn't seem to solve my issue. event.target
returns the HTML code of the <a-entity>
element, which doesn't allow me to retrieve the ID of the detected target image.
What I'm trying to do is retrieve the ID of the detected target image when the targetFound
event is triggered. I need this ID to retrieve specific elements from an array based on the detected image.
Here is the code I'm currently using:
mainElement.addEventListener("targetFound", (event) => {
console.log("target found");
console.log(event.detail);
});
When this event is triggered, event.detail
is always null
. I would like to know how I can get the ID of the detected target image from this event.
Thank you in advance for your help.
@ToorDev like I know there is no i'd on marker, there is targetIndex (or something like that). You can select it by just event.target.targetIndex and it will give you index. event.target return not HTML but DOM element so you can check what params was assign and select it.
Thank you for your suggestion. However, I’m still receiving ‘undefined’ as a response. My issue seems to be quite specific and, as I’m not very proficient in JavaScript, I’m going to close this issue and try a different approach. Thanks anyway to @BostonLeeK for your help.
Hello,
I am trying to use mindAR for a WebAR project and I am encountering an issue with the
targetFound
event.Here is the code I am using:
When this event is triggered,
event.detail
is alwaysnull
. I have tried using exactly the same code as provided in the mindAR documentation, but the issue persists.I am using the following versions of the libraries:
A-Frame: 1.4.2 mindAR: 1.2.2 Can you help me resolve this issue? Thank you in advance for your assistance.
Best regards