problem with Quaternion.Euler()

Hi all,
I have some difficulties to understand rotations with Quaternion.Euler(). I just want to rotate a Vector3 around another Vector3, to draw a bullet trajectory for instance.
So, Quaternion.Euler() was used, you can see the code below. extremePoint is the start of all rotations, centerRotation… you guessed it.

But I didn’t obtain what I expected : the gizmos generated from extremePoint are fine when extremePoint and centerRotation have the same Z (with different Xs, and all Ys = 0), but when Zs differ, the generated points go somekind of “straight” and don’t do the rotation toward the zenith (supposedly the last rorated point of the serie, just above centerRotation)
Second picture is the buggy case.

Did I miss a parameter, a translation somewhere ? I’m sorry if it’s a dumb question.
Any help is appreciated :slight_smile:

using UnityEngine;

[ExecuteInEditMode]
public class TestQuaternion : MonoBehaviour
{
    [SerializeField]
    private Transform centerRotation;
    [SerializeField]
    private Transform extremePoint;
    [SerializeField]
    int nGizmos = 100;

    private Vector3 zenith; // above centerRotation, same distance as [extremePoint.position - centerRotation] last point of rotations normally when Ys are same

    private void OnDrawGizmos()
    {
        zenith = centerRotation.position;
        zenith.y += Vector3.Distance(extremePoint.position, centerRotation.position);
        Gizmos.DrawSphere(centerRotation.position, 0.7f);
        Gizmos.DrawSphere(extremePoint.position, 1.5f);
        Gizmos.DrawSphere(zenith, 1.6f);
        Gizmos.DrawLine(extremePoint.position, centerRotation.position);
        Gizmos.DrawLine(zenith, centerRotation.position);

        drawRotatedGizmos();
    }

    private void drawRotatedGizmos()
    {
        Vector3 direction = extremePoint.position - centerRotation.position;
        float angleYInc = 360f / nGizmos;

        // draw gizmos around axe Y
        for (int aroundY = 0; aroundY < nGizmos; aroundY++)
        {
            Vector3 eulerAngles = new Vector3(0, aroundY * angleYInc, 0);
            Gizmos.DrawSphere(RotatePointAroundPivot(extremePoint.position, centerRotation.position, eulerAngles), 0.25f);

            if (aroundY == 0)
            {
                float angleZInc = 90f / nGizmos;
                // normally, draw gizmos rotated from extremePoint to zenith !
                for (int aroundZ = 0; aroundZ < nGizmos; aroundZ++)
                {
                    eulerAngles = new Vector3(0, aroundY * angleYInc, aroundZ * angleZInc);
                    Gizmos.DrawSphere(RotatePointAroundPivot(extremePoint.position, centerRotation.position, eulerAngles), 0.5f);
                }
            }
        }
    }

    // BUGGY ???
    public Vector3 RotatePointAroundPivot(Vector3 point, Vector3 pivot, Vector3 eulerAngles)
    {
        Vector3 direction = point - pivot;
        return pivot + Quaternion.Euler(eulerAngles) * direction;
    }

}