Draw a line to previous point

master
D4VID 4 months ago
parent 243c8a1461
commit 41047d9990

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

@ -54,6 +54,10 @@ namespace CameraRoll.Client.Tool {
}; };
point.AddComponent<PathPoint>(); point.AddComponent<PathPoint>();
PathPoints.Add(point); PathPoints.Add(point);
if (PathPoints.Count > 1) {
point.GetComponent<PathPoint>().LinkPreviousPoint(PathPoints[^2]);
}
} }
public static void Play() { public static void Play() {

@ -18,10 +18,26 @@ namespace CameraRoll.Client.Tool {
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 * AxisLength);
lr.material = new Material(Shader.Find("Unlit/Color")); lr.material = new Material(Shader.Find("Unlit/Color")) {
lr.material.color = color; color = color
};
lr.startWidth = 0.02f; lr.startWidth = 0.02f;
lr.endWidth = 0.02f; lr.endWidth = 0.02f;
} }
public void LinkPreviousPoint(GameObject point) {
GameObject line = new GameObject("Link");
line.transform.SetParent(transform, false);
LineRenderer lr = line.AddComponent<LineRenderer>();
lr.useWorldSpace = true;
lr.positionCount = 2;
lr.SetPosition(0, transform.position);
lr.SetPosition(1, point.transform.position);
lr.material = new Material(Shader.Find("Unlit/Color")) {
color = Color.magenta
};
lr.startWidth = 0.01f;
lr.endWidth = 0.01f;
}
} }
} }
Loading…
Cancel
Save