ActionManager "OnIntersectionEnterTrigger" lag / crash on iOs

Hello,

First of all, thank you for all that I learn here.

I have a project with an fps camera. There is a cube parented to the camera as an hitbox to trigger events using “OnIntersectionEnterTrigger”. The triggers are also just cubes or plans so no complicated meshes.

It’s work very well on all computers and android devices that I tested !

But on iOS devices there is a big lag /crash when I enter in a trigger one time in two.

  • On some playground I saw there is a “usePreciseIntersection: false” parameter but it didn’t resolve the problem
  • It can happen whatever the associated event is ( an animation.play() or just an updateOption() of a sound element ).
  • There is no error messages
  • All my textures are 1k max
  • Tryed to set the engine on webgl1
  • I had some of “setTimeout(function() { // Do something }, 5000)” that I turned into “setTimeout(doSomething, 5000);” because I saw it could provoke memory leaks but it didn’t change anything too.
  • Desabled all post-process effects

I’m using custom joysticks for mobile version, and some .wav sounds

I really don’t understand where this bugs come from…
Do you know another solution or a way to optimize this kind of interaction ?

I assume that will be complicated for you to help me without a playground, maybe I can share a temporary link of my project .

Thanks a lot for your help,

it would be easier for others to help you if you can create a playground with minimal code simulating this behvariour .

Here is a minimal playground where I experience the same issue on iPad :

https://playground.babylonjs.com/#C6V6UY#147

I tried it from iPhone but was not able to repro any issue, when I hit box it makes box disappear and box2 starts animating, it seems to work as in Safari Mac. any steps how could I reproduce this issue?

Thanks for trying it.
Yes it’s work perfectly on computer with safari, the issue is only on iOs.

After some tests without issue, it happened again several times again when I closed safari app and re-open it directly on this playground (on my iPad Air 2, iOs 14.4.4).
I think this is what happens when I send a link of my project to iPhone’s users to testing it. They report me crashes on iPhone 5 / 7+ / 11.

I tried to replace the ActionManager “OnIntersectionEnterTrigger” to an onCollide() function in my project and in this playground :
https://playground.babylonjs.com/#C6V6UY#152
A crashes still occur sometimes, maybe it’s because of the meshes colliding a certain way or a confusion about dispose the trigger ?