- Home /
 
               Question by 
               cmackinnonunity · Apr 09, 2015 at 04:28 AM · 
                unity 52daccelerometerinput.acceleration  
              
 
              Unity2D acceleromotor only at specfic angle
Hey basically I wish to have an input.acceleration which works when the phone is flipped from the landscape orientation... im creating a gravity based game and want this to be the mechanic which changes the gravityscale. Im also looking for the same effect however a reset when the phone is in the default position. I have looked at the official unity tutorial as well as several other tutorials as well as posts on unityanswers however these seem to be a more dynamic solution rather than for a singular event which I am looking for. This is what I have so far... Thanks
 if (Input.acceleration.y == Input.acceleration.y * 5.0) {
 
             rigidbody2D.gravityScale = -9.8f;
 
 
         } else if (Input.acceleration.y == Input.acceleration.y * 0) {
 
             rigidbody2D.gravityScale = 9.8f;
 
         }
I feel I am close to getting this correct so any help would be appreciated
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                