The problem is that when on mobile, the animation is inconsistent in the opening spin. What I expect is for the cube to appear and begin spinning and then land ‘near’ a face at which point the ‘snap back’ code will slerp the cube so that that ‘near’ face is square to the camera. What I see is that if there is any slowness to load, the timing on the animation changes completely and causes it to land ‘near’ a different face than expected which indicates to me the ticker isnt waiting until the scene is ready. So for example, if the animation script starts running a second earlier than the rest of the load then the duration will elapse even though no animation was visible and therefore when the animation thinks its done its only partially completed visually. Let me know if this doesnt make sense and I’ll find another way to explain it.
Any assistance or direction would be very helpful. Thanks!
The animation code itself is in AnimationCurve.js and follows the tutorial pretty closely. The animation is triggered at scene opening by setting a global variable to the window. That can happen ‘anywhere’ but I coded it into boot.js which is set as the first script in the load order. If you want to experiment, its fine to comment the PCSTARTED var out in boot.js and set it on the console while testing instead.
One other detail is that the cube ‘snaps to’ the nearest face when it detects the cube has very little velocity, but when the opening animation starts that feature should be disabled, therefore not interfering with the animation curve. In pullableBody.js it checks if the entity has the isAnimating flag set before allowing the snap back to activate. Its set in AnimationCurve.js and in my consoling I can see it properly disables the snap-back so shouldnt be an issue but wanted to point it out so its not a mysterious corner state.
In fact, as soon as I disabled, the animation starts correctly also on mobile.
Then it causes an exception.
I would try to go without the physic engine if not really needed, but if you need it, you should to find a way to know when the ammo engine is ready before to start the animation. I never used, so I don’t know how to ( yet )