How to dynamically know which image target found ?
See original GitHub issueEnvironment
Please provide the following information about your environment:
- Development OS: Mac Android Note 9 – OS 8.1
- Version: ViroReact 2.12.0 and React Native 0.56.0
Description
When I register multiple ViroARImageMarker using loop, it recognize all the images but only trigger the last one on onAnchorFound.
here is how I’m doing.
this._onAnchorFoundForVideoTarget = this._onAnchorFoundForVideoTarget.bind(this);
ViroARTrackingTargets.createTargets({
videoTarget_0 : {
source : { uri: videosData[0].ImageUrl } ,
orientation : "Up",
physicalWidth : 5 // real world width in meters
},
videoTarget_1 : {
source : { uri: videosData[1].ImageUrl } ,
orientation : "Up",
physicalWidth : 5 // real world width in meters
},
videoTarget_2 : {
source : { uri: videosData[2].ImageUrl } ,
orientation : "Up",
physicalWidth : 5 // real world width in meters
},
});
let views = [];
let i = 0;
console.log('_loadAllVideoMarkers',apiVideosData)
if(apiVideosData){
for (i = 0; i < apiVideosData.length; i++){
views.push((
<ViroARImageMarker
key={`videoTarget_${i}`}
target={`videoTarget_${i}`}
onAnchorFound={(e) => this._onAnchorFoundForVideoTarget(e, i)}
pauseUpdates={this.state.pauseUpdates}>
</ViroARImageMarker>
));
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to dynamically change image target image
In order to create Image Targets, you can use the Target Manager or use Insta Image Targets (which creates Image Targets at Run-time)....
Read more >Dynamic load of Image Target in Vuforia is possible
However as far as I know, all custom Image Targets have to be loaded through the 'My Trackables' part of the site then...
Read more >Setting up Image Targets - Unity - Manual
This section shows you how to set up a simple Image Target and get it responding to basic tracking events. To allow your...
Read more >About dynamic search ads - Microsoft Advertising Help Center
Dynamic search ads automatically target relevant search queries based on ... See What you need to know about dynamic ad targets below for...
Read more >Vuforia Engine: How to Create Image Targets - YouTube
In this Vuforia Engine augmented reality tutorial you'll learn how to create Image Targets using both the method through the developer ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @dthian ,
Thanks for your answer. Yes, onAnchorFound returns an object containing anchorId, but I cannot use it to found which image triggered? So, for now I added extra ‘target’ parameter in _onAnchorFound in ViroARImageMarker.js class like below.
If you add the found target name in response of the onAnchorFound callback it will be really helpful.
Thanks
Now I can use it like
From https://docs.viromedia.com/docs/viroarimagemarker it looks like onAnchorFound already provides you the anchor that was found and from it the id of the anchor. Thus you should already be able to dynamically know which anchor is found?