Trying to draw a cone with Ray, but it's dependent on the world axis

Hey, i’m trying to draw a cone which is composed of multiple raycasts. The origin is the orange cube, the target the grey.
This is the current result :

The same result, with a different position for the grey cube :

As you can see, the result is dependent on the world axis.

This is the script :

if (indexCircle <= maxNumberCircle)
{
    //Define the number of points, circles
    if(i == 0) listAllAnglesCirclePoints.Add(0);
    else if (i >= (indexCircle * baseNumberPointsPerCircle + indexCircle) + offsetIndex)
    {

        indexCircle++;
        offsetIndex = i;
        listAllAnglesCirclePoints.Clear();
        listAllAnglesCirclePoints.AddRange(Linspace(0,
            (indexCircle * baseNumberPointsPerCircle + 1 * indexCircle)));
        
    }

    //Set position of Ray
    if (indexCircle <= maxNumberCircle)
    {
        //Vector Direction between Target (posListener) and origin (propagationSource) 
        Vector3 newDirection = Vector3.Normalize(posListener - propagationSource.GetPosition());
        
        //Current Angle (radians) used to trace the Cone Shape 
        float currentAnglePoint = listAllAnglesCirclePoints[i - offsetIndex];
        
        Vector3 coord;
        coord.x = (float) indexCircle / maxNumberCircle;
        coord.y = (float) indexCircle / maxNumberCircle;
        coord.z = (float) indexCircle / maxNumberCircle;

        //Target Position according to the current Angle
        Vector3 newPosition;
        newPosition.x = posListener.x + (coord.x * Mathf.Cos(currentAnglePoint));
        newPosition.y = posListener.y + (coord.y * Mathf.Sin(currentAnglePoint));
        newPosition.z = posListener.z;
        

        Debug.DrawLine(propagationSource.transform.position, newPosition, Color.red);
        
    }
}

The points are correctly placed, like this, but totally dependant on the world axis. newPosition don’t depend on newDirection, and i have no idea how do i ensure that it depend on newDirection.

I would like the cone to be oriented towards the target, but i’m litteraly lost, so any help would be appreciated !
Thanks

Seems like a drawing/graphics question rather than a physics question. I only state that because this is obviously the physics forum and your questions seems more about general graphics.

Maybe someone will be able to help you here though.

I can see this is not physics, but if you want to check your maths, I do pretty much the same thing here: GitHub - AlTheSlacker/TransformStructureVisualiser: Unity editor tool to visualise transform structures in the scene view. . Because you are not necessarily in the global coordinate system, you need to construct your own local coordinate system based on the vector between the two points.

Perhaps that helps.

I wasn’t sure how to post, I will switch to the other forum !

I’m going to look into it, i was going in the wrong direction, but obviously that’s totally it, thanks !