void Update () { if(photonView.isMine) { if( !Vector3.ReferenceEquals(dest_POV, null))//type == PlType.Fugitive && { moveToDestPov(); } if(isDragging()) { if(Input.GetMouseButton(0)) { Vector3 vel = head.Gaze.GetPoint(dist_Draggable) - obj_Draggable.transform.position; obj_Draggable.ChangeVelocity(vel * vel.magnitude); } else if(Input.GetMouseButtonUp(0)) { obj_Draggable = null; UIManager_Border.Instance.SetCursorColor(Color.white); } } } else { transform.position = Vector3.Lerp(transform.position, this.correctPlayerPos, Time.deltaTime * 5); transform.rotation = Quaternion.Lerp(transform.rotation, this.correctPlayerRot, Time.deltaTime * 5); } }
public void CheckDraggable () { RaycastHit hit; if(Input.GetMouseButtonDown(0)) { if(Physics.Raycast(head.Gaze, out hit, Mathf.Infinity) && hit.collider.GetComponent<ObjectDraggable_ANMP>()) { obj_Draggable = hit.collider.GetComponent<ObjectDraggable_ANMP>(); dist_Draggable = hit.distance; } } }