Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to determine when controller is ready (model is loaded) #15

Closed
shegal opened this issue May 28, 2024 · 4 comments
Closed

No way to determine when controller is ready (model is loaded) #15

shegal opened this issue May 28, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@shegal
Copy link

shegal commented May 28, 2024

Problem: Need to play a specific animation and set camera to a specific position when model is loaded. Animations and positions are not same every time, so setting it via glb is not an option (if it's even possible for glb)

Possible solutions:

  • add a callback which triggers when model is loaded
  • specify initial animation and camera position for controller which is set after model is loaded
@shegal shegal changed the title No way to determine if controller is ready No way to determine when controller is ready May 28, 2024
@shegal shegal changed the title No way to determine when controller is ready No way to determine when controller is ready (model is loaded) May 28, 2024
@m-r-davari
Copy link
Owner

Hi,
About the callback which triggers after model loads completely, its good idea I will add it in next version,
or if you can please do it and create PR. it will be a helpful

About initial animation and camera position you mentioned.

I also will add initial cameraTarget and initial cameraOrbit argument to the either Flutter3dController class or Flutter3DViewer widget

more info may be useful for you :

If you call the playAnimation() method without passing animation name and model has at least 1 animation, package will play first animation by default.

cameraTarget default value is = "auto auto auto"
cameraOrbit default value is = "0deg 75deg 105%"

@m-r-davari m-r-davari added the enhancement New feature or request label Jun 4, 2024
@shegal
Copy link
Author

shegal commented Jun 7, 2024

I actually tried to add callback by myself, but didn't manage to do it via existing dart code and I have zero experience with JS so again didn't manage to find a quick solution inside web views / model viewer.

@PhantomKnight287
Copy link

Any update on this?

@m-r-davari
Copy link
Owner

m-r-davari commented Oct 5, 2024

Feature has been added in v2.0.0 ✅

  • Controller model loading value listener
  • Model loading states callbacks, onProgress, onLoad and onError

controller.onModelLoaded.addListener(() { //do something});
onLoad: (String modelAddress) { debugPrint('model loaded : $modelAddress'); },

checkout latest version

@m-r-davari m-r-davari pinned this issue Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants