// Update is called once per frame void Update() { float v = OVRInput.Get(OVRInput.Axis1D.PrimaryIndexTrigger, controller); SetFingers(1 - v); grabbed = OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger, controller); released = OVRInput.GetUp(OVRInput.Button.PrimaryIndexTrigger, controller); if (released) { released = false; if (grabbedEye != null) { grabbedEye.SetAttach(true); grabbedEye = null; } } }
void OnTriggerStay(Collider other) { Debug.Log(other.name); if (grabbed) { grabbed = false; EyeController eye = other.GetComponent <EyeController>(); if (eye != null) { // move to new position eye.transform.position = attachPoint.position; eye.transform.eulerAngles = attachPoint.eulerAngles; eye.transform.parent = attachPoint.transform; grabbedEye = eye; eye.SetAttach(false); } } }