mml-io / mml

Metaverse Markup Language
https://mml.io
MIT License
120 stars 13 forks source link

[Bug]: m-model animation fails to start playing immediately once switchin `anim-enabled` to true. #169

Open TheCodeTherapy opened 4 months ago

TheCodeTherapy commented 4 months ago

Describe the bug

Setting a valid anim attribute for an m-model with the attribute anim-enabled to false, to later on set anim-enabled to true, and anim-start-time to the current document time, doesn't work to start playing the animation immediately. Instead, the animation only plays when the page is refreshed.

https://github.com/mml-io/mml/assets/33723163/e7590cdb-71e6-4216-a1e6-7e473cb1e13b

Expected behavior

Presumably the animation should start playing as soon the anim-enabled attribute is set to true and the anim-start-time attribute is set to the current document time.

How to reproduce the bug

1) Create an m-model with a proper asset and URL for the anim attribute, but set anim-enabled to false, and then append it to the document; 2) Based on user action, set the m-model anim-enabled attribute to true, anim-loop to true, anim-start-time to document.timeline.currentTime, and remove the attribute anim-pause-time.

The animation should start based on the animation clips present in the asset passed as a URL to the anim attribute. Instead, it doesn't. However, if the user refresh the page, the animation will be playing.

Link to the code that reproduces this bug

https://github.com/TheCodeTherapy/3d-web-experience/blob/382e4e9e546b13fe0d36d3cd8d2a04a17b16460c/example/multi-user-3d-web-experience/server/mml-documents/example-cars.html

Packages

mml-web

Package versions

0.14.0

Extra details

No response