2

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?

Thanu
  • 2,481
  • 8
  • 34
  • 53
  • Just for clarification you want the object to be the same size visually, no matter how far away the person is viewing the object? – Alan-Dean Simonds Aug 12 '16 at 04:38
  • Yep, that one way to interpret what I want. – Thanu Aug 12 '16 at 05:45
  • What is the purpose of the object? Could you parent it what I can only assume is a player object or can they look away from it? Or use raycast distance to scale the object? – Alan-Dean Simonds Aug 12 '16 at 05:52
  • To be honest, My actual requirement is not for a Game. It is for a kids educational pack. So lets say we have a pack of cards, children will put them on the floor and look at them through the device standing up. So, in this case, 3D object has to be bigger than what's in the game scene. Additionally, It'll be great if I could make them go smaller when children bring the device closer to the marker (Card) – Thanu Aug 12 '16 at 06:06
  • 2
    Do you think you would be able to use raycast with AR? If so you could scale the object based on the distance between the raycast point and card. I have never used AR so I am not sure what options you have available but my first thought would definitely look at finding the distance between the user and the card and setting the local scale of the card to be inversely proportional to the distance. Hopefully with more information another user might check this question out for you. – Alan-Dean Simonds Aug 12 '16 at 06:10
  • Thanks Alan, Few good points there. I'll look into Raycast, haven't used it before. Like youh've mentiosn, defenelty need to find distance between the Marker and the AR Camera. That way I'll be able to do some calculation to scale the object. – Thanu Aug 12 '16 at 06:49

1 Answers1

1

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.

shalafi
  • 3,926
  • 2
  • 23
  • 27
  • Yep, I reckon you are right about is going out of AR concepts, but this was a requirement from the products team. Luckily it's not a requirement anymore. I'm a happy developer again :D – Thanu Aug 16 '16 at 00:56