private void Grab() { if (dragObject) { dragObject.LetGo (); dragObject = null; } else if (canDragMoveable) { canDragMoveable = false; Ray ray = Camera.main.ScreenPointToRay (mousePosition); RaycastHit hit = new RaycastHit (); if (Physics.Raycast (ray, out hit, KickStarter.settingsManager.moveableRaycastLength)) { if (hit.transform.GetComponent <DragBase>()) { dragObject = hit.transform.GetComponent <DragBase>(); dragObject.Grab (hit.point); lastMousePosition = mousePosition; lastCameraPosition = Camera.main.transform.position; } } } }
private void Grab() { if (dragObject) { dragObject.LetGo (); dragObject = null; } else if (canDragMoveable) { canDragMoveable = false; Ray ray = Camera.main.ScreenPointToRay (mousePosition); RaycastHit hit = new RaycastHit (); if (Physics.Raycast (ray, out hit, KickStarter.settingsManager.moveableRaycastLength)) { if (hit.transform.GetComponent <DragBase>()) { dragObject = hit.transform.GetComponent <DragBase>(); dragObject.Grab (hit.point); lastMousePosition = mousePosition; lastCameraPosition = Camera.main.transform.position; if (KickStarter.settingsManager.movementMethod == MovementMethod.UltimateFPS && KickStarter.settingsManager.disableFreeAimWhenDragging) { UltimateFPSIntegration.SetCameraState (false); } } } } }