cnr-isti-vclab / 3DHOP

3D Heritage Online Presenter
http://www.3dhop.net
GNU General Public License v3.0
154 stars 42 forks source link

Animation in sphere trackball [dynamic trackball declaration] #17

Closed DavidGilHidalgo closed 5 years ago

DavidGilHidalgo commented 5 years ago

Hi, I would like to know if it is possible to change the type of trackball without reloading the page. The idea is to use the sphere trackball to get total control over the 3D model. If I want to see an animation, switch to turntable trackball.

greetings and thank you for your help!

mcallieri commented 5 years ago

In theory, yes, but I never tested it properly. I remember doing it for some experiment, but never getting to the bottom of it. The trackball is a ariable inside the presenter object, that is created at the beginning of the scene, according to the parameters int he scene description, and then, later on, is just used through an interface common to all trackballs

so, if you do something like presenter.trackball = new desiredtrackball{ trackball parameters } it should change the trackball on the fly.

"trackball parameters" are the same parameters used in the scene description, so, basically, the same chunk of JSON structure you ise in the setscene.

Again, I never properly tested this. Side effects may include some errors in the console because there might be a small time frame where no trackball exists, interaction freezing, undefined positioning of the model, nuclear meltdown, death (not necessarily in this order).

DavidGilHidalgo commented 5 years ago

Thank you so much for the answer. I will follow your advice. Greetings