pmndrs / use-cannon

đź‘‹đź’Ł physics based hooks for @react-three/fiber
https://cannon.pmnd.rs
2.76k stars 155 forks source link

Physics animations freeze in Safari for macOS/iPhone #143

Closed waxpancake closed 3 years ago

waxpancake commented 3 years ago

Physics simulations that work perfectly in Chrome and Firefox never start animating in current and beta versions of Safari for macOS and iPhone, instead appearing to be completely frozen—reloading intermittently works, but not always. You can see this in the demos in the official repo, such as this one: https://g1s88.csb.app

I first noticed this when testing a very simple r3f/cannon splash page, which freezes virtually every time in Safari: https://codesandbox.io/s/react-cannon-splash-page-y0leb

Tested in the latest Safari 14.0.2 and Safari Technology Preview for macOS Catalina, and Safari 14 on iOS 14.2 running on an iPhone 11.

stockhuman commented 3 years ago

Hi, do you have any more information about this? Console output, perhaps?

waxpancake commented 3 years ago

Thanks for the response. Unfortunately, I don't see any console warnings or errors at all. As you can see in the screencaps below, it's intermittent in Safari for macOS, but it appears to happen every single time in iOS, I can't get physics animations to start at all in iOS.

Testing https://y0leb.csb.app/ : https://user-images.githubusercontent.com/6759/104223429-77b0c380-53f8-11eb-8d87-ba9fad259e2a.mp4

Testing https://g1s88.csb.app: https://user-images.githubusercontent.com/6759/104223616-b8a8d800-53f8-11eb-93f0-c157985e92e2.mp4

Happy to help debug or try anything you can think of.

stockhuman commented 3 years ago

This is a wild guess, but could you try this particular fork? I wonder if this may be due to worker loading. That, or canvas-based anti-tracking measures, perhaps? Does disabling Apple's tracking protection fix this? (I don't have a device with these browsers to test on).

waxpancake commented 3 years ago

Your fork resolves the issue entirely. Before trying it, I tested with content blockers and tracking protection disabled, and it made no difference.

stockhuman commented 3 years ago

Fantastic, thanks for the feedback! I think it's time I involve myself in the Discord and ask why lazy loading / dynamic imports were introduced & how crucial they are to performance, because integrating that fork may solve a few other issues.