poholo / panoramagl

Automatically exported from code.google.com/p/panoramagl
1 stars 0 forks source link

Implementation Gyroscope iOS #24

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Someone managed to implement the use of the gyroscope?

Original issue reported on code.google.com by GaBrIeLM...@gmail.com on 22 Aug 2013 at 4:30

GoogleCodeExporter commented 8 years ago
Hi I was facing the issues when implementing gyroscope in ipad. Its showing "No 
Gyroscope".

I was using this code when i need to start the gyroscope in panorama view or 
stop it.
-(void)startCompass
{

[plView setAccelerometerSensitivity:1];
    [plView startSensorialRotation];
}
-(void)stopCompass
{

     [plView stopSensorialRotation];
}

but it did not work , so little trick work for me. whenever you want to start 
compass , just add a dummy hotspot and keep its visibility hidden. so this work 
nice for me.

The working code is

-(void)startCompass
{
    [plView setAccelerometerSensitivity:1];
    [plView startSensorialRotation];

    NSString *iconPath = [[NSBundle mainBundle] pathForResource:@"hotspot1" ofType:@"png"];
    PLTexture *hotspotTexture = [PLTexture textureWithImage:[PLImage imageWithPath:iconPath]];
    PLHotspot *hotspot = [PLHotspot hotspotWithId:0 texture:hotspotTexture atv:0 ath:0 width:0.01 height:0.01];
    [currentPanoramaObject addHotspot:hotspot];
    // hotspot.panoramaImageId = dto.destPanoImgId;
    //hotspot.type = PLHotspotTypeNavigation;
    hotspot.alpha = 0;
    [plView.panorama addHotspot:hotspot];
}

i kept the width and height small and make it hidden. because its for dummy 
purpose.

Original comment by dr.amolj...@gmail.com on 11 Aug 2014 at 6:57