In my app, the user can be in drawing mode, or in a mode that lets them move the workspace (grid). When they are drawing a line segment, and get to the edge of the screen (in any direction), I'd like the workspace to move at a configurable speed in the direction. IOW, if they tap down to draw a line, then move their finger to the right edge, it should continuously move the workspace in that direction so the line drawing can continue. As it is now, they can only go to the edge of the screen. I hope I am explaining this well lol. Is this something that can be done easily with Touch Camera Pro? Thanks

    heiser I have to admit I'm not getting what you want to do, but the answer is yes you can move the camera with code. There is a function called "MoveCameraTo()" that let's you move the camera position and or rotation and or distance.
    Do you have touch camera pro or light? Do you have the demo scenes with it? If not I can send them to you.

      5 days later

      I have TouchCameraPro.

      I found the MoveCameraTo() method; what is the best way to move the camera, let's say, to the right? It looks like the best override would be the one that expects a new position via a Vector3, and if that's the case, which is the best way to retrieve the cameras current position so that I can modify then send to MoveCameraTo? It would be used in both Top Down and Perspective mode, if that matters. Thanks!

        heiser Hi!

        There is a demo scene called "Custom_Controls" that shows exactly that.
        Otherwise you're looking for the property "FinalOffset" for the camera position (offset on the floor) and MoveCameraTo() does take a Vector3 as you can see in the code documentation as well.

        Let me know if you have any issue.
        thanks

          Thanks Anthony, that worked!
          Here's the relevant code from the demo for others who may need to do this
          `
          void Update()
          {
          manualOffset = cam.FinalOffset;
          manualRotation = cam.FinalRotation;
          manualZoom = cam.FinalDistance;

              // Example code to move the camera based on keyboard arrow keys
              float h = Input.GetAxis("Horizontal");
              float v = Input.GetAxis("Vertical");
              manualOffset += transform.right.SetY(0).normalized * h * moveSpeed * Time.deltaTime;
              manualOffset += transform.forward.SetY(0).normalized * v * moveSpeed * Time.deltaTime;
          
              // Example code to rotate the camera based on I/O/K/L keyboards keys
              float hRotation = Input.GetKey(KeyCode.I) ? rotationSpeed : (Input.GetKey(KeyCode.O) ? -rotationSpeed : 0);
              float vRotation = Input.GetKey(KeyCode.K) ? rotationSpeed : (Input.GetKey(KeyCode.L) ? -rotationSpeed : 0);
              manualRotation = Quaternion.Euler(0, vRotation, 0) * manualRotation * Quaternion.Euler(hRotation, 0, 0);
          
              // Example code to change the zoom with R/T keys
              float zoomInput = Input.GetKey(KeyCode.R) ? zoomSpeed : (Input.GetKey(KeyCode.T) ? -zoomSpeed : 0);
              manualZoom += zoomInput;
          
              // You can apply translation, rotation and zoom at the same time with
              // cam.MoveCameraToInstant(manualOffset, manualZoom, manualRotation);
              // but here we are going to separate them just for the sake of the demo
              // and to show that they can be run at the same time
          
              if (h != 0 || v != 0)
              {
                  cam.MoveCameraToInstant(manualOffset);
              }
              if (hRotation != 0 || vRotation != 0)
              {
                  cam.MoveCameraToInstant(manualRotation);
              }
              if (zoomInput != 0)
              {
                  cam.MoveCameraToInstant(manualZoom);
              }
          }

          `

            Write a Reply...