Search Unity

ARFoundation - Use my own simple small 0.5m X 0.5m as plane to place prefab?

Discussion in 'AR' started by newguy123, Nov 8, 2018.

  1. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Hi Guys

    Instead of the AR Plane Prefab, I want to use my own simple small plane (about 0,5meter X 0.5meter). How would I go about to achive something like that? Making my simple plane into a prefab and sticking that into the "prefab to place" in AR Session Origin's "Place on Plane" script, doesnt seem to work at all. It only works with the AR Default Plane Prefab.
     
  2. tdmowrer

    tdmowrer

    Joined:
    Apr 21, 2017
    Posts:
    605
    What are you trying to achieve exactly? Are you trying to place some content that is .5x.5 meters, or do you want all planes to be visualized by a .5x.5 meter rectangle at their center?
     
  3. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    1)
    Instead of the default ugly yellow "plane" expanding over a surface to show it found a surface and then you can place your object on it, I just visually want a single 0.5meter X 0.5meter (in real life) plane to appear with a material on that says something like "place here". I think it will look more elegant. Also, if a new surface is detected before the user place an object, the single 0.5 X 0.5 plane should jump to the new location where a plane is detected. So if the user hover over a table, it should appear over the table, if he hovers off the table and over the floor, the plane should jump or move from the table and re-appear on the ground. This visually is more obvious what is expected of the user and he/she can place their object either on a table surface or on the ground or wherever a surface was detected. If an object is then placed, I want to either change the material of the 0.5 X 0.5 plane, or I just want to hide/delete it so all we see is the placed object. I should add that even though the plane is 0.5 X 0.5, my actual placed object will need the AR Session Origin scaled since my object is very large (150meter X 130meter). I will add a scaling slider to switch between a scale model or 1:1 size. But once the object is placed, I don't really care about the 0.5 X 0.5 plane anymore and don't need it after the object is placed (unless it should remain in scene for AR to remember where objects are in the world?)

    2)
    Furthermore, I have a directional light for the sun illuminating my object and casting shadow on itself (hard shadows). I want a second light, or another way, for the object to cast a soft dummy shadow on the surface it stands on just to cheat surface contact shadows. The directional light (sun) is just for my object and cast shadows on itself which is nice. The soft surface contact shadows should have nothing to do with my sun so whichever way that can be achieved without affecting my shadows on my object from my sun, that would be great (hope that makes sense!!!)


    If all else fails, I can live without the contact surface shadows, but I need the plane to be more elegant and to work. The plane can be disc shaped also (round plane).
     
    Last edited: Nov 9, 2018
  4. GreeneMachine

    GreeneMachine

    Joined:
    Jul 3, 2015
    Posts:
    126
    Hey

    You could make the existing plane visuals more elegant and to your liking... which will continue to support the existing planes expanding and merging as more information gets detected.

    Then for your "Place Content Here" you could raycast against them and place your own UI element or object where your raycast hit occurs.... this will adjust from table top to floor and vice versa.... as the user points their device.... and if placing your content at the hit point, it will reflect where the content will be placed. (Or you could say Tap Here and go with the placing content based on touch)

    This is basically a FocusSquare...

    https://forum.unity.com/threads/re-...s-using-ar-foundation-ar-raycast-help.548707/
     
  5. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248

    You're talking about things thats a bit above my current knowledge. It sounds very complicated. I just want something simpler like I described