Skip to content

Force the model to display in a certain color #5033

Discussion options

You must be logged in to vote

The model being undefined usually means the model hasn’t finished loading by the time showtime() runs. You might want to use the load event instead of relying on setTimeout. Similar to what I shared earlier. This part is key in the code I shared. .addEventListener("load", () => {.

Also, check that the script for model-viewer loads before your other code—order matters.

It’s tough to say for sure without seeing the full code. A Glitch link would make debugging easier! I recommend checking out the examples on the Model Viewer loading page and loading events—they should give you a better idea of how to handle this.

Hope that helps, and good luck with the rest of your project!

Its just too m…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@samaneh-kazemi
Comment options

@roberticomold
Comment options

@samaneh-kazemi
Comment options

@roberticomold
Comment options

Answer selected by roberticomold
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants