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
