Exemple #1
0
 void OnTriggerStay(Collider other)
 {
     if (other.tag == "Index" && Pincher.IsPinching())
     {
         Place();
     }
 }
Exemple #2
0
 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;
     }
 }
Exemple #3
0
    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();
            }
        }
    }