Visualize direction of point

master
D4VID 4 months ago
parent 41047d9990
commit d765f96f9a

@ -1,7 +1,7 @@
ID: D4VID_CameraRoll ID: D4VID_CameraRoll
Name: CameraRoll Name: CameraRoll
Author: D4VID Author: D4VID
Version: 0.2.2 Version: 0.2.3
Priority: 0 Priority: 0
ClientOnly: true ClientOnly: true
Dependencies: Dependencies:

@ -5,19 +5,19 @@ namespace CameraRoll.Client.Tool {
private const float AxisLength = 0.2f; private const float AxisLength = 0.2f;
void Start() { void Start() {
CreateAxis(Vector3.right, Color.red); CreateAxis(Vector3.right, Color.red, false);
CreateAxis(Vector3.up, Color.green); CreateAxis(Vector3.up, Color.green, false);
CreateAxis(Vector3.forward, Color.blue); CreateAxis(Vector3.forward, Color.blue, true);
} }
void CreateAxis(Vector3 dir, Color color) { void CreateAxis(Vector3 dir, Color color, bool longer) {
GameObject line = new GameObject("Axis"); GameObject line = new GameObject("Axis");
line.transform.SetParent(transform, false); line.transform.SetParent(transform, false);
LineRenderer lr = line.AddComponent<LineRenderer>(); LineRenderer lr = line.AddComponent<LineRenderer>();
lr.useWorldSpace = false; lr.useWorldSpace = false;
lr.positionCount = 2; lr.positionCount = 2;
lr.SetPosition(0, dir.normalized * -AxisLength); lr.SetPosition(0, dir.normalized * -AxisLength);
lr.SetPosition(1, dir.normalized * AxisLength); lr.SetPosition(1, dir.normalized * (longer ? 3 * AxisLength : AxisLength));
lr.material = new Material(Shader.Find("Unlit/Color")) { lr.material = new Material(Shader.Find("Unlit/Color")) {
color = color color = color
}; };

Loading…
Cancel
Save