Search Unity

Using image to trigger object placement

Discussion in 'Handheld AR' started by straylight, Oct 9, 2019.

  1. straylight

    straylight

    Joined:
    Jan 7, 2013
    Posts:
    11
    Hi.

    Is there a way to use an image to trigger the placement of an object that will persist on the ground plane even when the image is too far (small) to be recognised? So I envisage a user using a phone to scan a small QR code that then triggers the placement of a large 3D virtual sculpture on the ground that the user must step back from to view entirely at which point the QR code would be too small to be recognised but the sculpture would persist for the duration of the session. I'm looking at image tracking example in AR Foundation but I don't think this uses ground plane detection. Any help appreciated.

    J
     
  2. digableMatt

    digableMatt

    Joined:
    Dec 7, 2016
    Posts:
    11
    Have you tried anything yet? Image recognition works pretty well right now, and keeps the placement even when you turn around and walk away. How far do you plan on moving away?
     
  3. straylight

    straylight

    Joined:
    Jan 7, 2013
    Posts:
    11
    Hi. Yes I got it working. I added a plane tracker and the object is bolted to the floor now even when you cant see the original image! Now I'm trying to figure out how to instantiate multiple sculptures from different images (hopefully keep all five in memory at once).
     
  4. digableMatt

    digableMatt

    Joined:
    Dec 7, 2016
    Posts:
    11
    Thats great! Glad to hear you got that working. As far as instantiate multiple sculptures from different images, you'll want to run your app and print out the name of the image it detects and grab them from the console. I had to do this with object recognition since I couldn't find a way to get the name of the .arobject from the RerferenceObjectLibrary.

    So I did:
    print(args.added[0].name);

    and when it would recognize an object I would get:
    ARTrackedObject 4782472E544C80BB-202CBE48F80584C4

    These ids are unique and persist across sessions and even devices so i'm guessing the id is derived from the name you give it. Knowing the various ids of the objects I was tracking I did a simple switch, which then changed various text game objects and even fired off animations based on what it detected. You could do the same thing, but place your various sculptures based on a switch. You just need to know the ids of the images it is detecting.
     
    straylight likes this.