Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Dismiss Notice

Game Objects placed on ground plane in AR always sliding but no one's talking about it

Discussion in 'AR' started by mhussar, Apr 15, 2020.

  1. mhussar

    mhussar

    Joined:
    Feb 22, 2014
    Posts:
    11
    Hi All,

    I scoured the internet via search engines, online tutorial sites, Youtube and Unity forums, but after days of searching can not get a straight answer on how to ensure that when game objects are placed on a ground plane in AR that they do not slip and slide. Now I've implemented my AR IOS apps using all the best practices like proper lighting, real-life floors with varied physical features like knots in wood, etc, being mindful of reflective surfaces, using the latest verified packages for AR Foundation, ARKit, etc, using simple test code as a POC.
    I'm not a newbie developer and I've exhausted all the obvious possible reasons why the object doesn't stay fixed to the floor. I found some hope in possibly using ARAnchors but even this doesn't seem to be doing the trick. I'm coming to the conclusion that while creating ARKit apps via Unity is pretty neat, it's perhaps still not fully baked and can't yet achieve the feat of fixing a game object to a physical location like native Xcode ARKit can do.

    Can someone please disabuse me of this conclusion and direct me to a GitHub repo, Youtube video, code snippet, etc. that allows me to understand how to achieve this seemingly impossible feat in Unity.

    Please, kindly do not just direct me to ARAnchor in the Unity docs. I've already read the unity docs for AR and the existing docs do not help to resolve the problem.

    Best
    Mike
     
  2. DreamPower

    DreamPower

    Joined:
    Apr 2, 2017
    Posts:
    86
    Unity objects have a component on them giving them physics called the "Rigidbody", this is what makes it so if you drop or throw an object it falls realistically and then rolls around on the floor bumping into other objects. My guess is that's affecting you. If so you have some options, disable/remove the Rigidbody from the object you are trying to place, set it to "Kinematic" (either on the object or in code set the rigidbody.isKinematic), or give the object or the floor a physics material increasing the friction.
     
  3. mhussar

    mhussar

    Joined:
    Feb 22, 2014
    Posts:
    11
     
  4. mhussar

    mhussar

    Joined:
    Feb 22, 2014
    Posts:
    11
    Thank you for taking the time to reply. I wish your suggestion was the solution. I don't have rigid body components on my game objects. I know for sure this has to do with tracking in the Unity ARKit implementation. I just can't believe that I'm the only one that's mentioning this. I challenge anyone to find an example of using Unity to create an AR project where the placed object is rock solid. I'm thinking that Unity isn't there yet. I know this can be done natively in Xcode but not possible yet in Unity. I actually would pay good money if someone could send me a simple proof of concept for this.
    Thanks again!
     
  5. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    28
    To follow up, testing the Unity-provided repository shows these same issues:
    https://github.com/Unity-Technologies/arfoundation-samples.git

    Repro: build the repo, test the Simple AR, Anchor, Plane Occlusion and other demos on an iPhone 11.

    Occasionally object stick without 'sliding', but very frequently these objects slide all around.
     
  6. DreamPower

    DreamPower

    Joined:
    Apr 2, 2017
    Posts:
    86
    Maybe you are running into limitations of the iPhone single-camera tracking capabilities. Because I'm not running into this at all, but I'm using the new iPad Pro with the LIDAR. If you just make the detected planes visible, do you see them sliding around?

    A while back, I made a video comparing plane detection between LIDAR and iPhone XS camera tracking, if you look carefully you can see at around 47 seconds that the iPhone XS tracking shifts.

     
    Last edited: Aug 2, 2020
unityunity