Пример #1
0
    public Vector5 rotatePointAroundSpace(Vector5 point, float angle, RotationSpace5D space)
    {
        int[] spaceCoordinates = Rotation5D.getRotationSpaceIndices(space);
        int[] freeCoordinates  = new int[2];

        int a = 0;

        for (int i = 0; i < 5; i++)
        {
            if (!spaceCoordinates.Contains(i))
            {
                freeCoordinates [a] = i;
                a++;
            }
        }
        float X = point[freeCoordinates [0]];
        float Y = point[freeCoordinates [1]];

        float newX = X * Mathf.Cos(angle) - Y * Mathf.Sin(angle);
        float newY = X * Mathf.Sin(angle) + Y * Mathf.Cos(angle);

        point [freeCoordinates [0]] = newX;
        point [freeCoordinates [1]] = newY;

        return(point);
    }
Пример #2
0
 public void Reset()
 {
     position = Vector5.zero;
     rotation = new Rotation5D();
     scale    = Vector5.one;
 }