// Update is called once per frame void Update() { if (grabbedObject) { cursor.Set(transform.position, transform.rotation, Vector3.one); grabbedObject.FocusUpdate(this); } }
// Update is called once per frame void Update() { if (!isFocusGrabbed) { if (Physics.Raycast(transform.position, transform.forward, out hit, int.MaxValue)) { Vodget hitVodget = hit.transform.gameObject.GetComponent <Vodget>(); if (hitVodget) { // if there's no obj selected before if (!hitVodget.isSelected) { if (grabbedVodget == null) { grabPoint = hit.point; grabbedVodget = hitVodget; SetCursor(); hitVodget.Focus(this, true); } // if the hit object is not the obj the one that selector previously focused else if (grabbedVodget != hitVodget) { if (grabbedVodget) { grabbedVodget.Focus(this, false); } grabbedVodget = hitVodget; SetCursor(); hitVodget.Focus(this, true); grabPoint = hit.point; } } } // ray hit, but not hitting at a vodget else { if (grabbedVodget != null) { grabbedVodget.Focus(this, false); grabbedVodget = null; } } } //ray hit nothing else { //not shooting at any vodget if (grabbedVodget != null) { SetCursor(); grabbedVodget.Focus(this, false); grabbedVodget = null; } } } if (grabbedVodget) { SetCursor(); grabbedVodget.FocusUpdate(this); } }