Reset scaling of models in image target in unity and vuforia

孤街醉人 提交于 2019-12-02 12:24:31

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.

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!