Log in or register to post comments

Angle of ARCamera relative to ImageTarget

February 6, 2013 - 2:28pm #1

It seems to me that this has been discussed before, but I'm not finding the thread.  Using native development I know that I'd be working with the pose matrix...

Let's say you want to position an object to face the camera when it appears in AR space, I need only to determine where the AR camera is relative to the Image Target.  I suspect this is already stored somewhere as it's needed for Vuforia pose estimation anyhow.

How would you recommend implementing this?

Angle of ARCamera relative to ImageTarget

February 6, 2013 - 4:48pm #3

You're right, that does seem like the most straight-forward solution.  Thanks, I'll try that.

Angle of ARCamera relative to ImageTarget

February 6, 2013 - 2:47pm #2

That seems like it can be accomplished with the LookAt function - http://docs.unity3d.com/Documentation/ScriptReference/Transform.LookAt.html

There's also a SmoothLookAt script in the Standard Assets import, in the Camera scripts. You'll provide the ARCamera's transform for the assigned object to 'look at'.

The relative positioning of the camera and target are handled in the StateManagerImpl, using data mapped to a PoseData struct, but you probably won't have to work with this directly.

 

e.g.

    public struct PoseData
    {
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
        public Vector3 position;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
        public Quaternion orientation;
    }

 

Log in or register to post comments