- Home /
 
               Question by 
               TheDraker · Jun 29, 2017 at 06:24 PM · 
                unity 52dphysics2d-platformer2d-physics  
              
 
              Gravity Direction Change 2D
I want when a condition is true, the direction of gravity changes and the attraction instead of down, shift to the left.
Can someone help me? 
 
                 
                question.png 
                (128.9 kB) 
               
 
              
               Comment
              
 
               
              Answer by Jwizard93 · Jun 29, 2017 at 11:06 PM
You can change the gravity vector like this:
 Physics2D.gravity = new Vector2 (Xvalue, Yvalue);
So if you want the strength to stay the same but pull left instead of down just do:
 Physics2D.gravity = new Vector2 (Physics2D.gravity.y, 0);
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                