Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Issue with placing objects in the AR world.

Discussion in 'AR' started by Vallar, Nov 15, 2019.

  1. Vallar

    Vallar

    Joined:
    Oct 18, 2012
    Posts:
    177
    Hi,

    So I have an app that basically resembles a room. I detect the plane, place the room and everything works great.

    Now what I want to do is spawn a vase on top of a box in this room. The box is basically a Unity standard cube (so basically I want to place a Unity object over another Unity object, no real world related detection here). So what I did (for testing purposes) is just place an empty GO as a child of the cube, changed its position to be at the very top of the cube.
    Then I proceeded to use this line of code:
    Instantiate(vasePrefab, spawnPoint.position, Quaternion.identity);

    When testing on my phone, it seems the vase spawned. But for some odd reason the registered position is not the same as what I see the spawnPoint's position is in the inspector. So the vase spawns but it is no where to be found. The spawnPoint's position is (0, 1, 0.5). When building and the vase is placed, the vase reports a position of (0, -1, 0.5). The spawnPoint position also reports the same as the vase. But again, the vase is no where to be seen.

    There is no code manipulating ANYTHING in the room at all. So I am not sure what is wrong there. Any ideas?