private void GiveRayF() { if (model != null) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; //Vector3 screenSpace; if (Physics.Raycast(ray, out hit, float.MaxValue, mask.value)) { float normalY = hit.point.y + model.transform.gameObject.GetSize().y / 2; model.transform.position = new Vector3(hit.point.x, normalY, hit.point.z);; } else { if (model.activeInHierarchy) { model.SetActive(false); Debug.Log("Ray can't find floor..."); } } if (Physics.Raycast(ray, out hit, float.MaxValue)) { DoorAccessItem item = hit.transform.GetComponent <DoorAccessItem>(); if (item == null && hit.transform.childCount > 0) { item = hit.transform.GetChild(0).GetComponent <DoorAccessItem>(); } if (item) { ClearLastDoor(); DoorItem = item; ObjectModel_DoorAccess access = model.GetComponent <ObjectModel_DoorAccess>(); access.IsAccessInDoor = true; access.DoorItem = item; item.ConstantOn(Color.green); } else { ClearLastDoor(); } } else { ClearLastDoor(); } } }