Guest User

Untitled

a guest
Feb 25th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class HeightDisabler : MonoBehaviour
  4. {
  5. public float MaxHeight;
  6. private MeshRenderer _renderer;
  7.  
  8. void Start()
  9. {
  10. _renderer = gameObject.GetComponent<MeshRenderer>();
  11. }
  12.  
  13. void Update()
  14. {
  15. var ray = new Ray(transform.position, Vector3.down);
  16. this._renderer.enabled = !Physics.Raycast(ray, MaxHeight);
  17. }
  18. }
Add Comment
Please, Sign In to add comment