using UnityEngine;
using System.Collections; public class ScaleQuad : MonoBehaviour
{ public GameObject master; //Empty before the Quad
public GameObject quad; //The Quad I want to scale
Raycast hitInfo;
private Vector3 offsetOld; void Update()
{
var headPosition = Camera.main.transform.position;
var gazeDirection = Camera.main.transform.forward; if (Physics.Raycast(headPosition, gazeDirection, out hitInfo))
{
//Create the offset
offset = hitInfo.point - master.transform.position; // To get the new offset between hitpoint and master.transform.position for the new size
Vector3 diff = offset - offsetOld; vFBMaster.transform.position = new Vector3((diff.x + master.transform.position.x), (diff.y + master.transform.position.y), master.transform.position.z);
quad.transform.localScale = new Vector3((diff.x / ) + quad.transform.localScale.x, (diff.y / ) + quad.transform.localScale.y, quad.transform.localScale.z); Debug.Log(diff); //To save the old offset
offsetOld = offset; Debug.Log("Old Offset = " + offsetOld);
Debug.Log("new Offset = " + offset);
}
}
}