Chaotic Motion  1.0
BoundingBox.cs
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4 
5 [RequireComponent(typeof(LineRenderer))]
11 public class BoundingBox : MonoBehaviour {
12 
14  public float size = 10.0f;
15 
16  private LineRenderer lineRenderer;
17 
18  // Use this for initialization
19  void Awake () {
20  lineRenderer = GetComponent<LineRenderer>();
21 
22  // use cube
23  Vector3[] corners = {
24  new Vector3(0.5f,0.5f,0.5f),
25  new Vector3(0.5f,-0.5f,0.5f),
26  new Vector3(-0.5f,-0.5f,0.5f),
27  new Vector3(-0.5f,0.5f,0.5f),
28  new Vector3(0.5f,0.5f,0.5f), // end of top face
29  new Vector3(0.5f,0.5f,-0.5f), // down to bottom face
30  new Vector3(0.5f,-0.5f,-0.5f),
31  new Vector3(-0.5f,-0.5f,-0.5f),
32  new Vector3(-0.5f,0.5f,-0.5f),
33  new Vector3(0.5f,0.5f,-0.5f), // end of bottom face
34  new Vector3(0.5f,-0.5f,-0.5f), // over to next corner
35  new Vector3(0.5f,-0.5f,0.5f), // up
36  new Vector3(-0.5f,-0.5f,0.5f), // over
37  new Vector3(-0.5f,-0.5f,-0.5f), // down
38  new Vector3(-0.5f,0.5f,-0.5f), // over
39  new Vector3(-0.5f,0.5f,0.5f), // up
40 
41  };
42  lineRenderer.positionCount = corners.Length;
43 
44  for (int i=0; i < corners.Length; i++) {
45  corners[i] *= size;
46  }
47  lineRenderer.SetPositions(corners);
48 
49  }
50 
51 
52 }
float size
Size of the edge of the box.
Definition: BoundingBox.cs:14
Bounding box. Draw a box centered at the transform position using a line renderer. Used to give a spatial reference when tuning the global scale of a chaotic system.
Definition: BoundingBox.cs:11