Question by
Briyan_ap · Dec 27, 2016 at 03:33 AM ·
buttonaugmented-realityaugmented realitybutton trigger events
Click to show info problem.... Need Help...
Hello, i want to make slide information when object in the AR clicked like this... :
So, i follow instruction and type code like this :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InfoKlik : MonoBehaviour {
public Transform target1 ;
public Texture gambar1,gambar2,gambar3 ;
public string info1,info2,info3;
public Vector2 scrollposition1 = Vector2.zero;
public bool show = false;
void update() {
if(Input.GetMouseButton(0)) {
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
RaycastHit hit;
if(Physics.Raycast(ray, out hit)) {
if(hit.transform == target1) {
show=true;
}
}
}
}
void OnGui () {
if(show==true) {
GUI.BeginGroup (new Rect (Screen.width / 2 - 200, Screen.height / 2 - 250, 800, 500));
GUI.Box (new Rect (0, 50, 405, 360), "informasi");
scrollposition1 = GUI.BeginScrollView(new Rect(30,0,350,390),scrollposition1,new Rect(0,0,1150,200));
GUI.DrawTexture (new Rect(0,90,350,210),gambar1);
info1 = GUI.TextArea(new Rect(0,300,350,50),info1,200);
GUI.DrawTexture (new Rect(400,90,350,210),gambar2);
info2 = GUI.TextArea(new Rect(400,300,350,50),info2,200);
GUI.DrawTexture (new Rect(800,90,350,210),gambar3);
info3 = GUI.TextArea(new Rect(800,300,350,50),info3,200);
GUI.EndScrollView();
GUI.EndGroup();
}
}
}
And i drag that code to ARCamera the result is :
I insert Target 1 my 3d model but when running i klick on the model it dIdn't show information box, Why?
Comment
Your answer
Follow this Question
Related Questions
How do i implement OCR text recognition in unity? 2 Answers
multiple video sources AR (ARToolKit or Vuforia) 0 Answers
Does multiple spamming a button break it? 2 Answers
Vuforia detect large objects 2 Answers