Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
DrawSpaces.cs
Go to the documentation of this file.
1 using UnityEngine;
2 
3 namespace droid.Runtime.Utilities.GameObjects.Plotting {
6  public class DrawSpaces : MonoBehaviour {
7  void OnDrawGizmos() {
8  if (this.enabled) {
9  var color = Color.green;
10  // local up
11  this.DrawHelperAtCenter(this.transform.up, color, 2f);
12 
13  color.g -= 0.5f;
14  // global up
15  this.DrawHelperAtCenter(Vector3.up, color, 1f);
16 
17  color = Color.blue;
18  // local forward
19  this.DrawHelperAtCenter(this.transform.forward, color, 2f);
20 
21  color.b -= 0.5f;
22  // global forward
23  this.DrawHelperAtCenter(Vector3.forward, color, 1f);
24 
25  color = Color.red;
26  // local right
27  this.DrawHelperAtCenter(this.transform.right, color, 2f);
28 
29  color.r -= 0.5f;
30  // global right
31  this.DrawHelperAtCenter(Vector3.right, color, 1f);
32  }
33  }
34 
35  void DrawHelperAtCenter(Vector3 direction, Color color, float scale) {
36  Gizmos.color = color;
37  var position = this.transform.position;
38  var destination = position + direction * scale;
39  Gizmos.DrawLine(position, destination);
40  }
41  }
42 }