Thanks Anthony, I just tried the demo and this is exactly what I want except I still want to be able to do panning, when panning happens camera would lose the focus of the object and continue focusing on the floor until I click to refocus on the object. I am going to look how to combine these two together, if you have any tips it would be great. I have noticed that you have used perspective camera instead of free camera in the orbit demo, I thought that perspective camera could be somewhat problematic if we end up not looking down on the floor plane?

    Janna exactly, the perspective camera is meant to look down the floor, you can do the same with the free camera. Let me know if you're stuck. For the panning you need to have way to stop the "focusing mode" by providing a UI button or something like that to the user I think.

      Anthony Thanks! Is there a way to detect that we started to "pan" so I can automatically stop focusing and if user double clicks/start focusing on the object again to bring it back into "orbit mode" until another panning happens? Thanks!

        Janna there is no direct way to detect that the user is translating but you can achieve this using two things:

        • This method will tell you if the user has 2 fingers on the screen, or uses an input to drag according to the input map on your component. You will need to make that method public to access it from outside.
          IsInputMatching( InputMapFingerDrag.Translate )
          Keep in mind that this will return true also if you zoom with 2 fingers.

        • This will give you the center point on screen of all the fingers or pointers touching the screen. You can check if that points is moving over time to detect a translation:
          CameraInputs.screenPointAnyFingerCountCenter

        You can probably do it only with the 2nd code.
        Let me know how it goes.

        6 days later

        I have a couple of questions regarding getting the orbit camera to work 1 )In your OrbitDemo if we try to pan the scene pans for a split of the second and then gets back into the original position, is it possible to disable panning at all? So we can only have zoom and rotate in the orbit mode? To avoid glitchy looking behaviour

        2) In the same OrbitDemo if I move the Sphere up along Y direction the camera is no longer focusing on the Sphere but keeps focusing below. I have attached the photo. I have tried using Free Camera but got the same behaviour. Is there a way to adjust the camera so it is always looking at the centre of the target object? I thought this is what the code in OrbitDemo was doing but seems the camera is not going up.
        https://ibb.co/kG49HZZ

        I want to add that I tried to modify the code like this:
        //cam.MoveCameraToInstant(targetObj.position.SetY(0));
        cam.MoveCameraToInstant(targetObj.position);
        It does help to get camera to the same height as the Sphere but the orbiting seems glitchy.

          Janna I will work on that this week and keep you posted, thanks!

          Thanks! Have a good vacation as well! 🙂

            11 days later

            Janna Still on vacations, but I found some time to work on it. I will send you an update by email.

            1. I fixed the shaking by disabling the translation
            2. I used SetGroundHeight() to move the camera target on Y

            I updated the Camera Orbit demo scene and script.

            Hi Anthony,
            Thank you very much! I just tried it and it is looking really good, will be integrating into our project. I have noticed that in this package you sent there are lots of new changes, from the look on Camera Orbit script I just need that or do I need any changes that came in the updated project you sent?

              I think I can see that there are changes for DisableTranslations that I don't have in my version, so I will need to use the one you provided, are you planning to include this code in the latest TCP update? Thanks 🙂

                Janna Yes you need to import the full package, and yes it will be available in the next official release 😉

                  Write a Reply...