void OnTriggerStay(Collider other) { if (other.tag == "Index" && Pincher.IsPinching()) { Place(); } }
void OnCollisionStay(Collision collision) { // Start dragging if hand is currently pinching if (!dragging && collision.gameObject.tag == "Index" && Pincher.IsPinching()) { OnStartDrag(); //if(cursor.transform.FindChild("Cube") == null) this.transform.parent = cursor; } }
void Update() { // Limit maximum velocity of block float oldY = rb.velocity.y; Vector3 newVelocity = Vector3.ClampMagnitude(rb.velocity, maxVelocity); newVelocity.y = oldY; // don't clamp falling speed rb.velocity = newVelocity; if (dragging) { if (Pincher.IsPinching()) { OnDrag(); } else { OnRelease(); } } }