Hi, I have been using model target with much success, however, i couldnt interact with the model. The idea is to touch the model and it renders appears along with another image. I have tried this with a simple cube in an empty scene, however it doesn't work model generated by the vuforia engine.
the code is as follow:
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;
public class TouchPlay : MonoBehaviour { public Image Image; void Start() { var rend = gameObject.GetComponentInChildren<Renderer>(false); rend.enabled = !rend.enabled; Image.enabled = false; } // Update is called once per frame void Update() { if(Input.touchCount > 0 && Input.touches[0].phase == TouchPhase.Began) { Ray ray = Camera.main.ScreenPointToRay(Input.touches[0].position); RaycastHit hit;
if(Physics.Raycast(ray, out hit)) { if(hit.collider != null) { var rend = gameObject.GetComponentInChildren<Renderer>(true); rend.enabled = Image.enabled = !rend.enabled; } } }
}
}