Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class GetDimensions : MonoBehaviour {
  6.  
  7. private float width;
  8. private float length;
  9. private float height;
  10.  
  11. // Use this for initialization
  12. void Start () {
  13.  
  14. }
  15.  
  16. // Update is called once per frame
  17. void Update () {
  18. Dimensiones();
  19. }
  20.  
  21. void Dimensiones()
  22. {
  23. length = GetComponent<MeshFilter>().mesh.bounds.size.x * transform.localScale.x;
  24. width = GetComponent<MeshFilter>().mesh.bounds.size.z * transform.localScale.z;
  25. height = GetComponent<MeshFilter>().mesh.bounds.size.y * transform.localScale.y;
  26. print("width: " + width + ", length: " + length + ", height: " + height);
  27. } // end Dimensiones()
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement