This question was
closed Feb 07, 2019 at 08:38 PM by
muxe666 for the following reason:
Other
Question by
muxe666 · Feb 07, 2019 at 05:24 PM ·
transformcoordinateslocal
How to set up a min/max Local Z coordinate?
Hello, I've created a little script that I can move a camera with the mouse wheel on the local z coordinate. Now I want to limit how far the camera can move on the local z coordinate, can anyone help me?
Vector3 posCam = CamTransform.InverseTransformPoint(CamTransform.position);
float scroll = Input.GetAxis("Mouse ScrollWheel");
posCam.z = scroll * 200f * scrollSpeed * Time.deltaTime;
CamTransform.Translate(posCam);
Thanks! Greetings.
Comment
Follow this Question
Related Questions
Moving objects with Input.mouse in PC works but not with Android 1 Answer
Change Coordinate System of a direction vector (Vector3) 0 Answers
Real life frame position to relative position to camera rotation 0 Answers
Physics relative to parent 1 Answer
How can I model a building in Unity using lat, long, alt coordinates? 0 Answers