Android 安卓LidGDX。跟随CatmullRom样条线在3D中产生奇怪的结果

Android 安卓LidGDX。跟随CatmullRom样条线在3D中产生奇怪的结果,android,vector,3d,libgdx,spline,Android,Vector,3d,Libgdx,Spline,我有一个三维对象,它正在CatmullRom样条线中导航。我使用的代码取自Xoppa的答案: 有两种方法可以沿样条线对齐对象。我两个都试过了。而且两者都有奇怪的结果。 选项1基本正常,但出现奇怪的旋转…请参见下图: 选项2从选项1中删除了问题,但其他一切都不正常。请参见下图: 我的样条曲线: pointsArray = new Vector3[21]; pointsArray[0] = new Vector3(-5, -2, 2); pointsArray[1] =

我有一个三维对象,它正在CatmullRom样条线中导航。我使用的代码取自Xoppa的答案:

有两种方法可以沿样条线对齐对象。我两个都试过了。而且两者都有奇怪的结果。 选项1基本正常,但出现奇怪的旋转…请参见下图:

选项2从选项1中删除了问题,但其他一切都不正常。请参见下图:

我的样条曲线:

    pointsArray = new Vector3[21];
    pointsArray[0] = new Vector3(-5, -2, 2);
    pointsArray[1] = new Vector3(-4F, -1F, 2);
    pointsArray[2] = new Vector3(-3F, -0.5F, 2);
    pointsArray[3] = new Vector3(-2.0F, 0.3F, 2);
    pointsArray[4] = new Vector3(-1.0F, 0F, 2);
    pointsArray[5] = new Vector3(0F, -0.5F, 2);
    pointsArray[6] = new Vector3(1F, 0.5F, 2);
    pointsArray[7] = new Vector3(3F, 1F, 2);

    //loop
    pointsArray[8] = new Vector3(3.5F, 1F, 2.25F);
    pointsArray[9] = new Vector3(3.6F, 1F, 2.5F);
    pointsArray[10] = new Vector3(3.5F, 1F, 2.75F);
    pointsArray[11] = new Vector3(3F, 1F, 3F);
    pointsArray[12] = new Vector3(2.5F, 1F, 2.75F);
    pointsArray[13] = new Vector3(2F, 1F, 2.5F);
    pointsArray[14] = new Vector3(1.5F, 1F, 2.25F);
    pointsArray[15] = new Vector3(1F, 1F, 2.2F);
    pointsArray[16] = new Vector3(0F, 1.2F, 2F);


    pointsArray[17] = new Vector3(-1F, 1F, 2F);
    pointsArray[18] = new Vector3(-2F, 1.2F, 2F);
    pointsArray[19] = new Vector3(-3F, 1F, 2F);
    pointsArray[20] = new Vector3(-4F, 0.8F, 2F);

    catmull = new CatmullRomSpline<Vector3>(pointsArray, false);
所以我需要消除选项1中的旋转。或者更简单地修复选项2以正确旋转对象。我想有一件很简单的事情我没有注意到,一个擅长向量的人可以很容易地发现