Advertisement
DaDogeDevelopment

0 Gravity

Jun 5th, 2023
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | Gaming | 0 0
  1. using GorillaLocomotion;
  2. using UnityEngine;
  3.  
  4. public class GorillaGravityZone : MonoBehaviour
  5. {
  6.     private void Awake() => gameObject.layer = 2;
  7.  
  8.     private void OnTriggerEnter(Collider other)
  9.     {
  10.         if (other == Player.Instance.bodyCollider)
  11.         {
  12.             Debug.Log("Entered gravity zone");
  13.             Player.Instance.GetComponent<Rigidbody>().useGravity = false;
  14.         }
  15.     }
  16.  
  17.     private void OnTriggerExit(Collider other)
  18.     {
  19.         if (other == Player.Instance.bodyCollider)
  20.         {
  21.             Debug.Log("Exited gravity zone");
  22.             Player.Instance.GetComponent<Rigidbody>().useGravity = true;
  23.         }
  24.     }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement