-
Loving this library - amazing work. I've been using it extensively for a couple projects and thanks to these discussions I've been able to pull off pretty much everything I have needed to date. I was curious to see if anyone had suggestions on the most optimal way to accomplish a specific task related to annotation positioning when altering the orientation of a model. I am displaying a .glb model of a hardware device (a tablet with a display) that has a 16:9 orientation. The app allows users to apply their own textures to the screen through various means. Since it's a screen users may want to see that screen in landscape or portrait orientation depending on their content. I currently allow users to do just that by rotating the model in the view by animating the "orientation" property after they have double clicked or invoked/requested the app to to toggle between orientations of 0deg and 90deg. That all works great and its straightforward to animate that property. The issue arises if they also have annotations/hotspots turned on as visible, as those are initially defined based on the models default state of landscape orientation. If I animate that orientation value like: modelViewer.orientation = angle_animating_between_0_and_90+'deg 0deg 0deg'; The hotspots are still tied to the original orientation and thus are in the wrong place once the model orientation is rotating and completed rotating - they do not travel/sync with the models orientation. I've attached a video illustrating the concept and core issue using our astronaut friend: moonman_rotate.mp4And here is a simple reduced test case using jQuery and GreenSock to do exactly what I've described above and in the video to illustrate how changing the orientation of the model moves the model, but the hotspot positions do not sync along with that orientation change:
I could define another set of the same hotspots with the coordinates tied to either the 0degree or 90degree orientation (portrait vs landscape) and then turn them off while things are animating and simply turn on the second set of hotspots that map to the new orientation angle, after the rotation occurs, but that requires the creation/maintenance of two variations of that data and simply wont look as nice as it would if the hotspots/annotations were also animating their positions over time with the rest of the rotation of the models orientation. It also would be limited to those two discrete orientations and not dynamic orientation changes, so not really a worthwhile path to pursue in my mind. Ideally I am looking for a way to leverage the updateHotspot method to tailor the hotspots position and normal values (and possibly even the orbit and target values for the hotspots too) dynamically in realtime (through some sort of transformation) at the same time I am changing the main model orientation values, so that they can transform and animate right along with the degrees of the orientation and resulting animation of the model. I was hoping someone may have some guidance on a good approach to what kind of transformation I could apply to tackle this, or perhaps something I've overlooked that is already baked in that would do this automatically when changing the models orientation to keep the hotspot positions in sync. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I would say this is working as intended, but you're referring to a feature request that's been on the back burner for some time: animated hotspots. You're referring specifically to rigid-body animation, but really the same problem applies to skinned meshes, where it would be nice to define a hotspot such that it could follow e.g. the hoof of a galloping horse. The only trick is we need a different way to define the coordinates, since they're no longer simply in the world coordinate system. If you're interested in trying to solve this, a PR would be most welcome. |
Beta Was this translation helpful? Give feedback.
I would say this is working as intended, but you're referring to a feature request that's been on the back burner for some time: animated hotspots. You're referring specifically to rigid-body animation, but really the same problem applies to skinned meshes, where it would be nice to define a hotspot such that it could follow e.g. the hoof of a galloping horse. The only trick is we need a different way to define the coordinates, since they're no longer simply in the world coordinate system.
If you're interested in trying to solve this, a PR would be most welcome.