Dive Board



Gyroscope recalibration

Gyroscope recalibration

by iulius2000 on Nov 5th, 2014 17:34 PM

How can I recalibrate the gyroscope if I want to restart the current scene?

Example:
I play one scene and at the end of the scene, I am looking at the left.
No matter how fast I turn my head to look forward, after restart, the camera is oriented at left.
I want the new scene to start with a new calibration of the gyroscope, like the first time of playing.

The SDK reads the coordinates of the gyroscope only at the start of the Unity3d application?

iulius2000

Posts: 4

Joined: 18.09.2014


Re: Gyroscope recalibration

by unclebob on Nov 6th, 2014 11:13 AM

Hi mate

have the same problem see the topic below.

Interesting that you think its about Gyro recal. I thought I could get away with a simple look at an object/vector/direction in a scene and then fade in once completed.

With the camera pointing to an object or along a vector then that would accomplish the same thing.

Have tried parenting the camera controller to any game object and trying different methods to achieve this but as yet with no success.

Can you try running the scene with the Open Dive Sensor Script disabled and an attached Mouse Script to the Camera Controller activated?

Just to see if your code gives you the effect you want.

Have had a couple of fresh ideas, just from responding to you. If any work I will post them here.

Cheers

Unclebob

unclebob

Posts: 13

Joined: 03.09.2014


Re: Gyroscope recalibration

by agnostic on Nov 18th, 2014 18:29 PM

I have the same issue... I have a scene with a player turning to an X point, but when the game starts, the camera is looking to a different place, so I need to move myself to play.

agnostic

Posts: 14

Joined: 02.11.2014

dive-owner


Re: Gyroscope recalibration

by wurghi on Dec 4th, 2014 10:06 AM

cant you just copy your pan-rotation at the start of the scene to a float and substract it for the rest of the scene from your cameras pan-rotation?

wurghi

Posts: 10

Joined: 03.12.2014


Re: Gyroscope recalibration

by agnostic on Dec 4th, 2014 18:57 PM

"wurghi" wrote:
cant you just copy your pan-rotation at the start of the scene to a float and substract it for the rest of the scene from your cameras pan-rotation?



How? =/

agnostic

Posts: 14

Joined: 02.11.2014

dive-owner


Re: Gyroscope recalibration

by wurghi on Dec 5th, 2014 22:56 PM

inside your opendivesensor.cs at the top make a new variable like this "private float startrotation;"

then at the very bottom of void Start() { ..... add

yield;  // not sure if yield works in c sharp, i'm used to JS&#46;&#46;&#46; but shouldnt be that much different<br />while(transform&#46;eulerAngles&#46;y == 0)<br />{<br />yield;<br />}<br /><br />startrotation = transform&#46;eulerAngles&#46;y; // now the start rotation is stored inside the vraiable &quot;startrotation&quot;<br />


then at the very bottom of your void Update(){.... add
<br />transform&#46;eulerAngles&#46;y -= startrotation;<br />

wurghi

Posts: 10

Joined: 03.12.2014


Re: Gyroscope recalibration

by agnostic on Dec 6th, 2014 03:24 AM

Thank you!

agnostic

Posts: 14

Joined: 02.11.2014

dive-owner


STATISTICS


Total posts: 144342


Total topics: 34840


Total members: 42382


Newest member: Daniel G.