// Update is called once per frame void Update() { // Check selected point if mouse doesn't hit UI or the gizmo if (Input.GetMouseButtonDown(0) && RTGizmosEngine.Get.HoveredGizmo == null && EventSystem.current.currentSelectedGameObject == null) { GameObject pickedObject = PickCurvePoint(); if (pickedObject != m_selectedPoint) { ChangeSelectedPoint(pickedObject); } } if (Input.GetKeyDown(KeyCode.W)) { EnableTranslationGizmo(); } // Only key point can be rotated if (m_enableRotationGizmo && Input.GetKeyDown(KeyCode.E) && m_curveController.IsRotationKey(m_selectedPoint)) { EnableRotationGizmo(); } // Update transform of gizmo because the transform of the selectPoint may be changed by UI if (m_selectedPoint) { m_objectTranslationGizmo.SetTargetObject(m_selectedPoint); m_objectRotationGizmo.SetTargetObject(m_selectedPoint); } }
void SetRotationText() { if (!m_curveController.IsRotationKey(m_selectedPoint)) { return; } Quaternion quat = m_selectedPoint.transform.rotation; Vector3 euler = quat.eulerAngles; m_xangleInputField.text = euler.x.ToString(); m_yangleInputField.text = euler.y.ToString(); m_zangleInputField.text = euler.z.ToString(); m_wquatInputField.text = quat.w.ToString(); m_xquatInputField.text = quat.x.ToString(); m_yquatInputField.text = quat.y.ToString(); m_zquatInputField.text = quat.z.ToString(); }