Anthony,

I try to rotate the cam manually.
For this I used the function RotateFromVector(). However, I am a bit confused about the parameters and am looking for an example of how to call the function correctly.

I get -1 or +1 from the keyBindings, depending on where I want to rotate to, and have passed some values as parameters as a test. Unfortunately the camera does not rotate at all.

        var rotate = keyBindings.Camera.Rotate.ReadValue<float>();
        if (rotate != 0)
        {
            //cameraPerspective.RotateFromVector(Vector2.one * rotate);
            cameraPerspective.RotateFromVector(Vector2.one * 90);
        }

Thanks

    2 months later

    I updated via Unity Package manager and CameraBase.RotateFromVector() still exists

    Maybe I don't have the newest version now?

      Ok, some more infos. Maybe this is the main problem here. (Based on older version because RotateFromVector() still exists)

      Both events are fired if I use MoveCameratoInstant(Vector3).

      After I enabled some logs in both events I figured out, that
      cameraPerspective.MoveCameraToInstant(newPosition);

      fires

      Exoa.Events.CameraEvents.OnFocusStart
      Exoa.Events.CameraEvents.OnFocusComplete

      I need this function to move the cam by WASD as workaround, because your plugin ignores new inputsystem of unity.

      If i disabled this line, flooding of events stopped

              private void Update()
              {
                  var newPosition = Move(cameraPerspective.FinalOffset);
                 // cameraPerspective.MoveCameraToInstant(newPosition);
              }

      The given gameObject in Complete event is of course empty then. There is no focus 🙂

      Is there maybe another (better) way to use WASD with pre-calculated vectors?

        Dennis Indeed RotateFromVector is sitll used, my apologies.

        Here are 2 other fonctions you can add in CameraPerspective.cs that I will add in an upcoming update:

            public void ApplyPositionRotation(Vector3 p, Quaternion r)
            {
                finalOffset = CalculateOffset(p, r);
                finalDistance = CalculateDistance(p, r);
                finalRotation = r;
                finalPosition = p;
        
                ApplyToCamera();
            }
        
            public void ApplyRotation(Quaternion r)
            {
                finalRotation = r;
                ApplyToCamera();
            }

        These are directly changing the position/rotation of the camera without waiting for the next frame and without triggering events.

        Also there is a "CustomControl" demo scene in the last version that you can check to move/rotate the camera with keyboard inputs but it's using MoveCameraToInstant(). You can replace that with the functions above of course.

        Hope that helps!

          13 days later

          thank you - solved with example in custom control demo scene

          Write a Reply...