Is it possible to rotate a drawable in absolute mode? I tried rotate.heading but I think it's relative to the user. I would like for example a drawable with face pointing always north.
M
Martin Lechner
said
almost 9 years ago
Hi Maurizio,
Unfortunately, rotation is always relative to the user facing the Drawable. You cannot set a Drawable to be statically oriented.
Best,
Martin
M
Maurizio Cecatto
said
almost 9 years ago
Thank you Martin for the answer, I see that with SLAM you can position statically a Drawable so I hope this can be a feature in future releases.
M
Maurizio Cecatto
said
over 8 years ago
Since it's not possible, I tried to manually rotate a drawable based on user position. In clustering script of Andreas Hauser I found a function to evaluate the angle between two location then I used that angle to rotate the drawable everytime the user location changes. It seems to work, maybe when the user is very close to the drawable I should consider also the rotation of the phone.
I appreciate any contributions. Thanks.
A
Andreas Fötschl
said
over 8 years ago
Hi Maurizio,
Nice approach, I think for now this is the only solution for your isssue. You may inject compass rotation from native code via architectView.callJavascript (similar to Retrieving POI Data from Application Model sample) every second and animate the rotation of the AR.GeoObject accordingly.
Hope that helps.
Kind regards
A
Anders Melen
said
about 8 years ago
Mind sharing a link to said function. Thanks
A
Andreas Fötschl
said
about 8 years ago
how to receive compass values from native iOS/Android code is kinda clear I assume. You need to define a "onCompassValueChanged" - function (naming is up to you) in your JS code. Fetch compass values in native environment and call architectView.callJavaScript("onCompassValueChanged(" + currentValue + ")") in your JS-funciton you then modify the rotation values of your AR.Model accordingly.
Additionally note that 3D Models always face towards the user, so you may also need to put the angle between user and 3D Model into account and add it to your rotation.
Best regards & Sorry for inconvenience - Upcoming 3D Tracking/SLAM approaches will make that a lot easier to accomplish. Andreas
A
Anders Melen
said
about 8 years ago
Thanks Andreas. I'm looking forward to those upcoming approaches.
Maurizio Cecatto