// Todo: Locking joints by clicking on them private void Update() { // TODO Buttons don't work anymore bool mouseLeftDown = Input.GetButtonDown("unity_mouse_0"); bool mouseLeftUp = Input.GetButtonUp("unity_mouse_0"); bool mouseLeft = Input.GetButton("unity_mouse_0"); Vector3 cursorPosition = Input.mousePosition; if (mouseLeftDown) { GameObject selectedObject = QueryCursor(cursorPosition); if (selectedObject) { MuscleJoint joint = selectedObject.GetComponent <MuscleJoint>(); if (joint) { StartDragging(joint); } else { _camera.Center = selectedObject.transform.position; } } } if (mouseLeftUp) { StopDragging(); } if (mouseLeft) { if (_isDragging) { Drag(cursorPosition); } else { Look(); } } if (_jointHierarchy != null && _ikHierarchy != null) { IKSolver.Slerp(_ikHierarchy, _jointHierarchy, 10f * _clock.DeltaTime); } }