Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Unity 2022.2 is now available as the latest Tech release.
    Dismiss Notice
  3. We are making some changes to the DOTS forums.
    Dismiss Notice
  4. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Question Instantiating multiple objects when looking at different images (ARFoundation)

Discussion in 'AR' started by jetlius, Apr 29, 2022.

Thread Status:
Not open for further replies.
  1. jetlius

    jetlius

    Joined:
    Feb 6, 2018
    Posts:
    9
    I'm trying to create an app that spawns (instantiates) multiple different objects in AR, depending on the image that is being detected during runtime.

    I was able to develop all the detection and spawning of the objects for each different image, and the 3D objects even follow the position of those images.

    However, I have been looking for a way to solve an issue with the rotation of those objects. Whenever I instantiate a new object, its rotation doesn't change, i.e. the rotation of the new spawned object is always the same as the first one that was detected during runtime, even if I change scenes during runtime.

    I have tried multiple ways to save the rotation of my trackedImage, and force that rotation onto the gameObject, but it just isn't working, and I don't understand why.

    I tried changing its rotation in the same place where I'm tracking the position (inside UpdateImage), I have tried inside the foreach loops, I have tried changing the rotation only when I'm instantiating, etc, and it just doesn't work.

    This is my ImageTracking script:
     

    Attached Files:

  2. ankur-unity

    ankur-unity

    Unity Technologies

    Joined:
    Aug 12, 2021
    Posts:
    31
Thread Status:
Not open for further replies.