OtsoSilver

Untitled

Oct 2nd, 2021
1,214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class GravityTurnTest : MonoBehaviour
  6. {
  7.     public int gravity = 1;
  8.     // Start is called before the first frame update
  9.     void Start()
  10.     {
  11.        
  12.     }
  13.  
  14.     // Update is called once per frame
  15.     void Update()
  16.     {
  17.         if (Input.GetKeyDown(KeyCode.Space))
  18.         {
  19.             gravity *= -1;
  20.             print("change grav");
  21.             ChangeGravity();
  22.         }
  23.     }
  24.  
  25.     void ChangeGravity()
  26.     {
  27.         Physics.gravity = new Vector3(0, -1 * gravity, 0 );
  28.     }
  29. }
  30.  
  31.  
Advertisement
Add Comment
Please, Sign In to add comment