Reset scaling of models in image target in unity and vuforia

前端 未结 2 1124
情书的邮戳
情书的邮戳 2021-01-29 01:11

I\'m using Vuforia and unity for my AR App. which has more than 2 models/image targets. To zoom in and out I used Lean Touch. But the problem is both will get zoom on pinching .

相关标签:
2条回答
  • 2021-01-29 01:59

    The trouble here is that Vuforia doesn't deactivate the 3D object attached to the image target, it only deactivates his renderer component and the colliders so you can't put a filter asking for the active state of the game object as @Everts sugest.

    Instead you can have an script where you have a public reference to both 3D game objects and a method where you set the scale of both objects to one, every time you lost your image target you should call that function and both game objects will be his scale set to one.

    Another solutios is, Vuforia knows wich marker found so when you detect a marker you can activate set that game object to be the one to suffer the scale efects.

    0 讨论(0)
  • 2021-01-29 02:10

    Your method doing the scaling, add :

    if(this.gameObject.activeSelf == false){ return; }
    // Scaling process
    

    So if you run the code on all objects, only the active ones will be affected. Considering you deactivate the object on lost tracking.

    0 讨论(0)
提交回复
热议问题