Federico-Ciuffardi/GestureControlledCamera2D

There is a problem with the mobile browser running this project

Opened this issue · 10 comments

Have you tried exporting this project as html? I tried it and open it through a mobile browser,found that something is wrong with gesture recognition, but I can't solve it.
This is the html file I exported, you can try to run it.

export.zip

I just tried it, found that the recognized gesture doesn't always match the actual gesture I'm doing and sometimes even when it does match, the gesture properties are wrong.

This seems weird to me as it works fine on Android. I suspect this has to do with webGL, I found some posts describing similar behavior with WebGL:

The posts are from the Unity forums, but the behaviors are similar, and Unity also uses webGL. I didn't find anything conclusive or directly related to Godot, but most likely the problem is related to webGL and not this project itself.

You can try asking this at https://godotforums.org/ or https://godotengine.org/qa/tag/forum.

I'm going to leave this issue open for others to know and help if they find anything relevant to this problem.

I'm getting the same issue with the html5 export using the ios safari browser. single finger drag works well rotating appears to work as expected but the pinch in and out to zoom jumps back to being zoomed even when pulling fingers apart. it will begin zooming out and then snap quickly zoom in while moving fingers apart.
I don't know how difficult/possible it would be to implement, or if you would even want to implement it, but using the JavaScript API I would think would make it stable for html5 exports. running this simple test here gives me consistent colors. The code here I would think could be integrated into Godot with Javascript and watching FinPointCGI tutorial right now to see to actually use it. Anyway not sure if this is useful, hopefully yes :)

Hi @ChildLearningClub, thanks for your comment!

I think this is an issue with Godot and not with my project, as this works fine on android.

After doing some research I think the problem is probably related to this function as it seems to handle touch input in html5/javascript.

If you want, you can research further and open an issue on Godot's Github.

Perhaps you should try Godot 4.0 first (if you haven't already) to see if this is already fixed in the latest version.

Let me know if you find something new.

@Federico-Ciuffardi thank you for your response. I agree definitely seems to be something to do with the way it’s being translated over. I thought that maybe using the JavaScript API directly might be a good work around, but you are right it really doesn’t address the root of the problem. But honestly I’m just starting off with figuring things out with Godot and programming, so I really don’t know.
When Godot 4 supports html5 I will be sure to try it. Oh and I wanted to say thank you for your Godot plugins. The plugins are really helpful for new guys like me, that have no idea how to build that functionality ourselves :)

Godot 4.3 Dev 3 added support for single threading so I was able to do a follow up test with Godot 4 on iOS Safari. It appears that the multi-finger-drag and the pinch are conflicting?

RPReplay_Final1708833794.mp4

Edit: It does however look like the same code that you referenced above was carried over to Godot 4 if that is in fact the cause? Should I open an issue on Godot's GitHub page?

Actually it appears that it is not an issue of conflicting drag and pinch, but possibly the use of relative? That is probably what you were referring to here. It seems that that the It is either the code in Godot as you mentioned or the way that zoom is calculated here The distance remains stable however as you can see in the video below so maybe we can implement that as the condition to zoom in and out similar to this?

RPReplay_Final1708908824.mp4

@Federico-Ciuffardi what are your thoughts?

I asked in the Godot forum as you suggested here is the link. I tested a web export using this code to zoom and it works as it should. I think swapping out the code using the relative function with distance between the points will fix this within the plugin.

I think the root of the problem is that there is a bug in how Godot implements touch input in the web export, as the problem only seems to occur there.

Therefore, I would prefer to keep the current implementation to give more visibility to the root problem. And also because one of the goals of this project is to show the capabilities of GDTIM, such as the pinch relative, which seems to work except for web export.

To solve the issue temporarily while the web export issue persists, you can locally replace the GestureControlledCamera2D zoom implementation with the alternative implementation or use it independently of this plugin.

If you end up replacing the GestureControlledCamera2D zoom implementation with the alternative implementation, let me know and I will create a branch so you can make a PR there, and we can have a temporary alternative version that works with web export for others who need it.

I think the root of the problem is that there is a bug in how Godot implements touch input in the web export, as the problem only seems to occur there.

Therefore, I would prefer to keep the current implementation to give more visibility to the root problem. And also because one of the goals of this project is to show the capabilities of GDTIM, such as the pinch relative, which seems to work except for web export.

To solve the issue temporarily while the web export issue persists, you can locally replace the GestureControlledCamera2D zoom implementation with the alternative implementation or use it independently of this plugin.

That makes sense, if I can figure out how to stitch the two together I will let you know :)