How do i create a mesh on a line renderer in world space?

Hi, im able to create a mesh on a line renderer through .BakeMesh the issue im having is that the mesh is created in local space, I need it in world space to match the line renderer. Heres my code:

            lineChild = Instantiate(linePrefab, lineManager.startObject.gameObject.transform);

            // Create a new LineRenderer component
            lineRenderer = lineChild.GetComponent<LineRenderer>();
            MeshCollider meshCollider = lineChild.AddComponent<MeshCollider>();

            lineRenderer.material = lineMateral;
            lineRenderer.startWidth = 0.04f; // Set the starting width of the line
            lineRenderer.endWidth = 0.02f; // Set the ending width of the line

            // Set the start and end points of the line renderer
            lineRenderer.SetPositions(new Vector3[] { lineManager.startObject.transform.position, lineManager.endObject.transform.position });

            Mesh mesh = new Mesh();
            lineRenderer.BakeMesh(mesh, true);
            meshCollider.sharedMesh = mesh;

            Vector3[] vertices = mesh.vertices;
            for (int i = 0; i < vertices.Length; i++)
                vertices _= lineRenderer.transform.TransformPoint(vertices*);*_

mesh.vertices = vertices;

meshCollider.sharedMesh = mesh;

Debug.Log(“Line Added”);

lineManager.lineIsActive = false;

lineManager.startObject = null;
lineManager.endObject = null;
I’ve tried fixing it using .TransformPoint but that didn’t work, anyone got any ideas?
Heres a pick of where the mesh is being generated. [206158-mesh-in-local.jpg|206158]_

Hello, my solution to match the LineRenderer with the baked mesh was the other way round: Don’t use world space for the LineRenderer.

// the baked mesh doesn't use world space and would be offset if this is set to true
lineRenderer.useWorldSpace = false;

Hope this helps.