gyrocontroller

nedr
Posts: 15
Joined: Fri Aug 18, 2017 12:30 pm

gyrocontroller

Postby nedr » Thu Dec 07, 2017 11:31 pm

While testing I noticed the great working gyrocontroller when moving my tablet. But when I embed my forgejsproject with a iframe on another page, it does not work anymore. Is this correct and is it possible to get it working when embedded as a iframe.

And is it possible to have gyro controll and touch controll at the same time? Now in the embedded version I can change direction with touch, but when giro works, touch does not move..
(version 0.9.5)

nedr
Posts: 15
Joined: Fri Aug 18, 2017 12:30 pm

Re: gyrocontroller

Postby nedr » Fri Dec 08, 2017 12:13 am

I found out that iframe url has to be relative for the gyrocontroller... so with external url's it does not work... I think

but would love to have both controllers: pointer and qyroscope...

User avatar
rroux
ForgeJS Team
Posts: 166
Joined: Wed Oct 26, 2016 12:19 pm

Re: gyrocontroller

Postby rroux » Fri Dec 08, 2017 10:16 am

Hi nedr,

As far as I know you can't have both gyro and pointer controller at the same time.
It is not as trivial as it sounds to implement this feature.
If you know how to code this feature, I'll be glad to review your pull request on Github :)

Have a nice day !
- Raphaël

nedr
Posts: 15
Joined: Fri Aug 18, 2017 12:30 pm

Re: gyrocontroller

Postby nedr » Fri Dec 08, 2017 10:34 am

Hi rroux,

Thx for your fast reply. I understand. I will try some stuff ;-)

Is it possible to turn the gyro on or off? in the json? or in the player maybe?

User avatar
rroux
ForgeJS Team
Posts: 166
Joined: Wed Oct 26, 2016 12:19 pm

Re: gyrocontroller

Postby rroux » Fri Dec 08, 2017 12:46 pm

Hi nedr,

To turn the gyro off / on on the json configuration, you can look at my answer to this topic :
viewtopic.php?f=8&t=1188

To turn the gyro on / off with javascript, the answer is yes, you can do it with something like this :

  1. //Get the gyroscope controller
  2. gyroscope = this.viewer.controllers.getByType(FORGE.ControllerType.GYROSCOPE);
  3.  
  4. //Enable the gyro
  5. gyroscope.enabled = true;
  6.  
  7. //Disable the gyro
  8. gyroscope.enabled = false;


This code is inspired by the GyroscopeButton plugin available here :
https://github.com/gopro/forgejs-plugin ... eButton.js

Hope this helps !
Have a nice day
- Raphaël

Who is online

Users browsing this forum: RidgeveP and 1 guest