private void Rotation()
        {
            if (Input.CursorMode == CursorLockMode.Locked)
            {
                MouseRotation += (Vector2D)Input.CursorMovement * MouseSensivity * Time.DeltaTime;
            }

            if (MouseRotation.x < 0)
            {
                MouseRotation.x = MouseRotation.x + 360;
            }
            if (MouseRotation.x > 360)
            {
                MouseRotation.x = MouseRotation.x - 360;
            }
            if (MouseRotation.y < -90)
            {
                MouseRotation.y = -90;
            }
            if (MouseRotation.y > 90)
            {
                MouseRotation.y = 90;
            }

            _M.Rotation = EQuaternion.FromEuler(MouseRotation.y, MouseRotation.x, 0.0F);
        }
Exemple #2
0
    //[Hybridizer.Runtime.CUDAImports.Kernel]
    public static Vector3D RotatePointAroundPivot(Vector3D point, Vector3D pivot, Vector3D angles)
    {
        Vector3D dir = point - pivot;                // get point direction relative to pivot

        dir   = EQuaternion.FromEuler(angles) * dir; // rotate it
        point = dir + pivot;                         // calculate rotated point
        return(point);                               // return it
    }