Search code examples
augmented-realityunity-game-engineartoolkit

Inverse zoom in/out (scaling) of AR 3D model using ARToolkit for Unity5


I have done a AR project using ARToolkit for Unity. It works fine but the problem I'm trying to solve here is to inverse the scaling on 3D model. Right now when you take camera further away from the marker 3D object go smaller (Zooms out) and if I bring the camera closer,the 3D model gets bigger. But what I want to do is opposite of this behaviour.

Any ideas on how I go about it?


Solution

  • I think this is a bad idea because it completely breaks the concept of AR, which is that the 3D objects are related to the real world, but it is definitely possible.

    ARToolkit provides a transformation matrix for each marker. That matrix includes position and rotation. On each iteration, the object is updated with those values. What you need to do is find where that is applied to the object and then measure the distance to the camera and update the translation to be at the distance you want.

    That code is in the Unity plugin, so it should be easy to find.