1 (edited by grenouille 2020-06-12 10:13:22)

Topic: [SOLVED] Gyro and Mouse controls interactions

Hello,

In my application using uPano, the GyroControl and MouseControl components seem to not interact very well.
If I try to pan the panorama using my finger while the GyroControl is active, it will snap back to the previous "gyro position".
I'd like to pan the view using my finger and keep the angle I've set (after releasing the touch) while still using GyroControl.

Is there an easy way to implement this behaviour using uPano controls ?

Thank you.

Re: [SOLVED] Gyro and Mouse controls interactions

Hello.

Thanks for the bug report.
Modified scripts attached.

Post's attachments

Attachment icon uPano - GyroMouse Fix.unitypackage 3.03 kb, 6 downloads since 2020-06-12 

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: [SOLVED] Gyro and Mouse controls interactions

Thank you !

When I import the package I get the following error :

MouseControl.cs(212,34): error CS1061: 'Pano' does not contain a definition for 'GetInputPosition' and no accessible extension method 'GetInputPosition' accepting a first argument of type 'Pano' could be found (are you missing a using directive or an assembly reference?)

I use the last version of uPano (2.1.1.1).
The packaged modified 3 files : GyroControl.cs, MouseControl.cs and PanoControl.cs.

Re: [SOLVED] Gyro and Mouse controls interactions

Oops ...
I made modifications in the dev version of the asset, and the modified files contain APIs that are not yet present in the published version.

You have two ways:
1. Replace the line that causes the error from

inputPosition = pano.GetInputPosition();

to

inputPosition = Input.mousePosition;

2. Email me (support@infinity-code.com) with your invoice number and I will send you the latest dev version of the asset.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: [SOLVED] Gyro and Mouse controls interactions

I replaced the line with

inputPosition = Input.mousePosition;

and it works perfectly.

Thank you very much !

Re: [SOLVED] Gyro and Mouse controls interactions

Hello,

I modified the code of GyroControl.cs (that you provided) to be able to smoothly reset the rotation delta applied with the MouseControl.

The function is as follows:

public void ResetRotationDelta(float duration)
{
    if (!DOTween.IsTweening(rotationDelta))
    {
        DOTween.To(() => rotationDelta, x => rotationDelta = x, Vector2.zero, duration);
    }
}

I'm using the DOTween library but it's probably doable without it.

I think it would be a very nice addition to the GyroControl.