Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
2.98k stars 1.11k forks source link

How to track simulated ar tracked images that are moving #1069

Closed scara1701 closed 7 months ago

scara1701 commented 1 year ago

I've added the XR Simulation to my project. I've added a script to the simulated tracked image which moves and rotates it over time.

My ar tracked image manager has the number of maximum moving images to track set to 10.

Upon starting the player, my prefab set in the ar tracked image managers spawns, however they do not all follow the movement of the simulated tracked image.

Is this scenario supported in the XR Environment, or have I made a mistake somewhere?

I've uploaded a video example here: https://www.youtube.com/watch?v=3IBtnWzIXgo

I've uploaded my project to github: https://github.com/scara1701/Unity-XREnvironment-TrackedImageIssues

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

andyb-unity commented 7 months ago

Upon starting the player, my prefab set in the ar tracked image managers spawns

This is not the recommended way to spawn content. You should subscribe to the ARTrackedImageManager.trackedImagesChanged event, and Instantiate your content as a child of the ARTrackedImage GameObject.

We have sample code for this here: https://github.com/Unity-Technologies/arfoundation-samples?tab=readme-ov-file#image-tracking-with-multiple-prefabs

I'm closing this issue as answered, but feel free to re-open it if you have further questions.