Hello everybody,
I would like to modify the TargetMover script and limit the length of the raycast. I’ve tried it myself, but apparently I am doing something wrong. Could somebody help me?
// Fire a ray through the scene at the mouse position and place the target where it hits
RaycastHit hit;
if (Physics.Raycast(cam.ScreenPointToRay(Input.mousePosition), out hit, Mathf.Infinity, mask)) {
newPosition = hit.point;
positionFound = true;
}
}```