示例#1
0
    public Vector4 rotatePointAroundPlane(Vector4 point, float angle, RotationPlane plane)
    {
        int[] planeCoordinates = Rotation4D.getRotationPlaneIndices(plane);
        int[] freeCoordinates  = new int[2];

        int a = 0;

        for (int i = 0; i < 4; i++)
        {
            if (!planeCoordinates.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
    // Update is called once per frame
    void Update()
    {
        Rotation4D r4 = transform4D.localRotaion;

        r4.xw += Time.deltaTime * 33.36f;
        r4.yw += Time.deltaTime * 42.12f;
        r4.zw += Time.deltaTime * 61.88f;
        transform4D.localRotaion = r4;
    }
示例#3
0
 public void Reset()
 {
     position = new Vector4();
     rotation = new Rotation4D();
     scale    = Vector4.one;
 }