Ray ray = gameObject.camera.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, 5/Float Distance/)){
transform.position = /vector 3 ( position at end of ray distance )/
}
let say between me and float distance lies box if I would look at box I would get position
vector 3 (0,0,1)
I would achieve that with this code
Ray ray = Player.camera.ScreenPointToRay(Input.mousePosition);
RaycastHit hit; // declare the RaycastHit variable
if (Physics.Raycast(ray,out hit)) {
transform.position = hit.point
}
hit point would be vector 3 (0,0,1)
but if that box is still there I want to find the vector 3 (0,0,5) so it would go through box and on float distance would stop and look it’s position
I hope I explained well what I need
if not I’ll need to make a picture
done on request
[8390-for+unity+ask+a+question.jpg|8390]