POV aim to follow mouse precisely

Hello,

I have a globe (sphere) that I want to “hold-to-drag” (rotate) on. When moving mouse / touch I want the globe to rotate with the movement. A good example is how MapBox does it here:

No matter what I try I get inconsistent movement. This is my current setup:

I’ve tried both modifying axisValue and value. I feed them with “screenDelta” mouse movement

What does it do that’s wrong?

If you grab onto a label in the MapBox example the label almost precisely follow the mouse movement. When I do it with Cinemachine the mouse drifts away from what I “grabbed onto”. The closest I’ve gotten is to do:

_pov.m_VerticalAxis.m_InputAxisValue = delta.y * Time.deltaTime;
_pov.m_HorizontalAxis.m_InputAxisValue = delta.x * Time.deltaTime;

And have 100 as the POV speed but it’s still not following precisely

@Gregoryl It feels better when providing the Axis Name. What exactly is happening behind the curtains when Axis Name is set to the actual value? Something with frame-independency or something is different to what I’m doing (I’m using ScaledDelta from a third-party library (LeanTouch)

Cinemachine POV is driving only the camera rotation. It knows nothing about what you click and drag on, and there is no logic to convert screen pixels to rotations in such a way as to “lock” the mouse onto anything. If you’re getting nice results sometimes it’s just a fluke, and is unlikely to work reliably under different conditions.

You will likely need to write a custom script that understands what you click on (distance from camera is important here) and converts the mouse movement to rotational motion, and then feeds the result directly to pov.m_HorizontalAxis.Value and pov.m_VerticalAxis.Value.

Okay but what setup would be ideal if you’d want to replicate the effect from the MapBox example?

Edit: I’m quite happy with the effect I’m getting when Mouse X / Mouse Y are set as the input axis names however my game needs to control these from touch / whilst pressing/clicking the screen. How are the Axis Name(s) working? Are they just adding the mouse delta to the value?

AxisState.Update() is just doing axis.m_InputAxisValue = CinemachineCore.GetInputAxis(axisName), which is a delegate which by default calls Input.GetAxis(axisName).

To process input only when a button is pressed, you would override CinemachineCore.GetInputAxis with a handler that first checks for the button being pressed before calling Input.GetAxis(). Here is an example: https://discussions.unity.com/t/698898/5

I don’t understand what info you’re looking for. As I said, there is no guarantee that the mouse will lock onto anything unless you write some custom code to make it happen.