GameObject Distance Question.

Hello,
How can I do that the object distance can be from 0f till 3f in the Z pos?

This Distance in Function…

Vector3 MousePosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, Distance);

Thanks all for help!

Vector3 MousePosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, Mathf.Clamp(Distance, 0f, 3f));

What number I have to set the distance variable? And My blocks goes under the terrian map what should i do?

Please explain what you are trying to do.

I`m trying to make the GameObject able to go far from me and close to me (far = 3f and 0f = close.)

Have you checked out ScreenToWorldPoint?

Vector3 PlacingObjectPosition = Camera.main.ScreenToWorldPoint(MousePosition);
PlacingObject.transform.position = PlacingObjectPosition;

Yay!

Why yay?