I have an ImageRecognition dataset with multiple images in it. Currently, my code initializing the trackable2DObjects looks like this:
trackable2DObject = new AR.Trackable2DObject(leftTracker, "Water", { onEnterFieldOfVision: seeWater, onExitFieldOfVision: unseeWater});
trackable2DObjectTwo = new AR.Trackable2DObject(leftTracker, "Carbon_Dioxide", { onEnterFieldOfVision: seeCarbonDioxide, onExitFieldOfVision: unseeCarbonDioxide});
Isn't there a way to avoid this ugly, hardcoded code?
Can't I create an array of and two generic seeImage(param) and unseeImage(param) functions and still have the same functionality? Ideally, my list of images is dynamic. Furthermore, I hate my current hardcoded lines and code duplication.
var trackable2DObject = new AR.Trackable2DObject(leftTracker, molecules, {onEnterFieldOfVision: toSeeMolecule(molecules), onExitFieldOfVision: toUnseeMolecule(molecules)});
Caroline