1 (edited by negruj0w1tsch 2020-10-26 11:23:26)

Topic: DragAndZoomInertia.cs vs InertiaExample.cs

Hello,

This may be a weird question, but I'm wondering which of the 2 Inertia examples you would recommend using. Apart from the zoom, is one of the 2 scripts better than the other in any way (e.g. cleaner code, more concise code, easier to tweak etc...)?

Regards,

Jürgen

Re: DragAndZoomInertia.cs vs InertiaExample.cs

Hello.

DragAndZoomInertia is an improved version of InertiaExample that adds zoom inertia.
Which example to use depends only on whether the zoom should have inertia or not.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: DragAndZoomInertia.cs vs InertiaExample.cs

Alright, thanks. I'm using the Drag and zoom intertia script now. It feels a little jaggy, or not as smooth as it could be imo. I assume this is because the position and zoom are updated inside the FixedUpdate method instead of Update. Any particular reason for that?

Cheers,

Jürgen

Re: DragAndZoomInertia.cs vs InertiaExample.cs

I just tested this and it works smoothly on my side.
Please explain in detail what you mean by "jaggy".
Maybe I'm just looking the other way.
A short video here will help a lot in explaining the problem.

This script was written many years ago and unfortunately I don't remember why I used FixedUpdate.
In theory, this should work the same in Update and FixedUpdate.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: DragAndZoomInertia.cs vs InertiaExample.cs

Well, I would call them "micro stutters" or something like that. It's a very subtle thing that just starts to happen when the camera is not perfectly synced with the scene. If I'm not mistaken the example-script updates the tile/map-position in FixedUpdate which happens only a fixed amount of times per second and not at full framerate. I'll paste a modified version of the script which does the tile-position-update in the Update method. It's subtle but for me the difference is notable. Feel free to correct me on that, this has a lot to do with subtle perception. The script allows to toggle between the original mode and the Update base mode.

Regards,

Jürgen

Post's attachments

Attachment icon SmoothOnlineMapsInertia.cs 3.75 kb, 78 downloads since 2020-10-28