I have a new problem.
Now I can add size and reduce the size of the Model, but I do not want to remove the camera to shine. Marker, Model I, Model based on past by Hierarchy is as follows:
1. AR Camera
2. Directional light
3. ImageTarger
4. teapot
But when I changed to a new Hierarchy is as follows:
1. AR Camera
2. Directional light
3. ImageTarger
-------teapot
When I press the button to add a Model size has gone from a Marker, but enough to reduce the size of the Model, holding back the same.
What Code do I need to add?
Help me
My Code ::
using System;
using UnityEngine;
using System.Collections;
public class ButtonZoomCap : MonoBehaviour {
public Texture zoominpic;
public Texture zoomoutpic;
public Texture capturepic;
public float sW;
public float sH;
public bool mCap,mZoom;
private int screenshotCount = 0;
public GameObject teapot;
private Vector3 tempScale;
// Use this for initialization
void Start () {
//teapot = GameObject.Find("teapot");
tempScale = teapot.transform.localScale;
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.Escape))
{
Application.Quit();
}
if (mCap == true)
{
string screenshotFilename;
do
{
screenshotCount++;
screenshotFilename = "screenshot" + screenshotCount + ".png";
} while (System.IO.File.Exists(screenshotFilename));
Application.CaptureScreenshot(Application.persistentDataPath + "/mnt/sdcard/" + screenshotFilename);
}
}
void OnGUI() {
sW = Screen.width;
sH = Screen.height;
mCap = false;
mZoom = false;
if (GUI.Button (new Rect (Screen.width - 100,Screen.height - 70,100,100), zoominpic)) {
tempScale = teapot.transform.localScale;
float xx = tempScale.x;
float yy = tempScale.y;
float zz = tempScale.z;
tempScale.x = xx + 0.5f;
tempScale.y = yy+0.5f;
tempScale.z = zz+0.5f;
teapot.transform.localScale = tempScale;
}
if (GUI.Button (new Rect (Screen.width - 200,Screen.height - 70,100,100), zoomoutpic)) {
float xd = tempScale.x;
float yd = tempScale.y;
float zd = tempScale.z;
tempScale.x = xd - 0.5f;
tempScale.y = yd -0.5f;
tempScale.z = zd -0.5f;
teapot.transform.localScale = tempScale;
}
// Capture Screen
if (GUI.Button (new Rect (Screen.width - 300,Screen.height - 70,100,100), capturepic)) {
mCap = true;
}
}
}