How to get camera position relative to plane tracker

Hi there,
I am trying to place elements in a circle around the user in a scene that uses the plane tracker. I want a snapshot of the position of the camera and then place the objects under the plane tracker so that they form a circle and keep their tracked position afterwards. I have found no easy solution for this as I am having trouble getting the world coordinates of the camera or rather the position of the camera relative to the plane tracker.
What am I missing here?

I’m not at all an expert but this sounds like something to do with the view matrix.

This article looks like it may have some answers: https://www.3dgep.com/understanding-the-view-matrix/

“ In this article, I will attempt to explain how to construct the view matrix correctly and how to use the view matrix to transform a model’s vertices into clip-space. I will also try to explain how to compute the camera’s position in world space (also called the Eye position) from the view matrix.”

Hope this helps.

You might try using the camera distance patch and see if that works.

I’ve had some issues getting world position of plane tracker in the past, and my workaround wasn’t really an extendable solution.

Here’s a thread that might help you out

Well I’m glad to know there isn’t something obvious I’ve missed. Did have the thought about Camera distance patch also. Can we agree that it’s super annoying Camera Distance is not directly available in script? Thanks for the feedback, it’s appreciated.

Hey @Udart, like josh already posted, I was fighting a similar problem. The relevant post with working code in that thread is this one:


The rest is mostly me crying about the API, which is also relevant but not script

2 Likes

Well I never found a solution to this problem - getting world position coordinates of the camera. The camera distance patch cannot be used as it only measures a one-dimensional distance - not 3 dimensions.

Have you tried using the global transform patch? You can’t feed the camera directly to it, but you can add a null or a plane to the camera and use that.

I think my issue was getting the global position of the plane tracker objects. It was super inconsistent between the simulator and device, but maybe that’s changed since then.