m-r-davari / flutter_3d_controller

The most complete Flutter package for rendering interactive 3D models in various formats (GLB, GLTF, OBJ, FBX), with the ability to control animations, textures, camera, and more.
https://pub.dev/packages/flutter_3d_controller
MIT License
101 stars 13 forks source link

Troubles with animations on android mobile device / emulator #41

Open shegal opened 1 day ago

shegal commented 1 day ago

I have code like this:

_viewer = Flutter3DViewer(
        enableTouch: false,
        progressBarColor: Colors.transparent,
        onLoad: (String modelAddress) {
          _controller.setCameraOrbit(-30, 90, 75);
          _controller.playAnimation(animationName: 'idle');
        },
        controller: _controller,
        src: 'assets/models/character.glb');

It works on web platform (after model is loaded 'idle' animation starts playing), but on android mobile device (emulator and real device both) it doesn't work (model stays in t-pose until screen is refreshed somehow, but camera orbit is set correctly).

Previously I have experienced some issues like that because of lags on mobile device so doing some small delay between setting camera orbit and playing animation was fixing the situation, but this time delay trick didn't work out, so problem is probably somewhere deeper.

m-r-davari commented 9 hours ago

Hi @shegal , Thanks for reporting this, For now please put 500-1000 milliseconds delay before you do your logic in onLoad callback.

I will fix it in next version