public static void DrawLine(Vector3 start, Vector3 end, Color color, float time, bool depthTest, float radius) { Vector3 position = start + (end - start) * 0.5f; Quaternion rotation = Quaternion.LookRotation((end - start).normalized); Vector3 scale = new Vector3(radius, radius, (end - start).magnitude); WorldDebugLine newLine = new WorldDebugLine(); newLine.matrix = Matrix4x4.TRS(position, rotation, scale); newLine.stopTime = Time.time + time; newLine.material = depthTest ? new Material(lineDepthMat) : new Material(lineMat); newLine.material.color = color; lines.Add(newLine); }
public static void DrawLine(Vector3 start, Vector3 end, Color color, bool depthTest, float radius) { Vector3 position = start + (end - start) * 0.5f; Quaternion rotation; if ((end - start).magnitude == 0) { rotation = Quaternion.identity; } else { rotation = Quaternion.LookRotation((end - start).normalized); } Vector3 scale = new Vector3(radius, radius, (end - start).magnitude); WorldDebugLine newLine = new WorldDebugLine(); newLine.matrix = Matrix4x4.TRS(position, rotation, scale); newLine.stopTime = 0; newLine.material = depthTest ? new Material(lineDepthMat) : new Material(lineMat); newLine.material.color = color; Graphics.DrawMesh(mesh, newLine.matrix, newLine.material, 0); }
public static void DrawLine(Vector3 start, Vector3 end) { Vector3 position = start + (end - start) * 0.5f; Quaternion rotation; if ((end - start).magnitude == 0) { rotation = Quaternion.identity; } else { rotation = Quaternion.LookRotation((end - start).normalized); } Vector3 scale = new Vector3(0.005f, 0.005f, (end - start).magnitude); WorldDebugLine newLine = new WorldDebugLine(); newLine.matrix = Matrix4x4.TRS(position, rotation, scale); newLine.stopTime = 0; newLine.material = new Material(lineMat); newLine.material.color = Color.white; Graphics.DrawMesh(mesh, newLine.matrix, newLine.material, 0); }