ORIGINAL
private void UpdateThumbPosition() { Vector3 vIn = Vector3.zero; if (VRTK_Events(1)) { if (VRTK_Events(1).triggerPressed && VRTK_Events(1).touchpadPressed) { vIn = VRTK_UIPoint(1).pointerEventData.pointerPressRaycast.worldPosition; ui_ladder.Info_Box(1, "VTKpos: " + VRTK_UIPoint(1).pointerEventData.position.ToString("F2")); } } if (VRTK_Events(2)) { if (VRTK_Events(2).triggerPressed && VRTK_Events(2).touchpadPressed) { vIn = VRTK_UIPoint(2).pointerEventData.pointerPressRaycast.worldPosition; ui_ladder.Info_Box(1, "VTKpos: " + VRTK_UIPoint(2).pointerEventData.position.ToString("F2")); } } //if (circular) // { // Debug.LogError ("No 'CircleCollider' found on object. Please add a CircleCollider or turn off 'circular'."); //} SpectrumXY = new Vector2 (colorPalette.GetComponent<RectTransform> ().rect.width* scaleAdjust * myScale.transform.localScale.x, colorPalette.GetComponent<RectTransform> ().rect.height* scaleAdjust * myScale.transform.localScale.y); PictureBounds = colorPalette.GetComponent<Collider> ().bounds; Max = PictureBounds.max; Min = PictureBounds.min; Vector3 cent = transform.position; float dz = vIn.z - cent.z; float dx = vIn.x - cent.x; Horzmag = Mathf.Sqrt(dx * dx + dz * dz); float y = vIn.y; Vector3 vPoint = vIn - cent; if(Vector3.Dot(Vector3.Cross(vPoint,transform.forward),transform.up) > 0) { Horzmag = -Horzmag; } dx = Horzmag; cent.y = 0f; Vector3 newPos = cent + new Vector3(dx, y, dz); thumb.transform.position = newPos; value = GetColor (); getColor_w_AlphaVal(); //Sets Panel Colors }