Search code examples
unity-game-engineaugmented-realityarcore

ARCore custom object not touching the tracked plane with bottom


I am experimenting with the ARCore SDK inside Unity to make an Augmented Reality app. As a start I ran the HelloAR Demo app where the ground is detected and onto which you can place multiple Andy's when tapping on the screen. I notice the Andy's are placed on top of the plane, as it should.

Now, I create a 3D Cube object and replaced the Andy prefab with the Cube. This places Cubes instead of Andy's in the app. However, I notice that the bottom of the cube is not touching the plane! The plane runs through the center of the cube, which is not an ideal scenario!

I looked on the internet for a solution, but haven't found it yet. On another website there was someone with the same issue, but no solution was provided. Only a reponse stating that it works only with the ARCore demo objects, not with custom objects.

Can someone help me out on this one?

Thanks!


Solution

  • I have found the solution to my problem.

    The pivot point of my Cube GameObject was in the center. All I did was wrap an empty GameObject around the Cube and repositioned the pivot point to the bottom of the Cube. From this I created a Prefab and used it inside the app. Now the cubes are placed correctly on top of the plane.