コード例 #1
0
    float GetDegreeRotation()
    {
        float degrees = 0f;
        float X       = InputAbstraction.GetAxis(InputAbstraction.AxisAlias.X, InputAbstraction.PreferedHand());
        float Y       = InputAbstraction.GetAxis(InputAbstraction.AxisAlias.Y, InputAbstraction.PreferedHand());

        bool XIsNegative = X < 0 ? true : false;
        bool YIsNegative = Y < 0 ? true : false;

        X = Mathf.Abs(X);
        Y = Mathf.Abs(Y);

        degrees = (YIsNegative ^ XIsNegative) ? Mathf.Atan(Y / X) * (180 / Mathf.PI) : Mathf.Atan(X / Y) * (180 / Mathf.PI);

        if (YIsNegative && !XIsNegative)
        {
            degrees += 90;
        }
        else if (YIsNegative && XIsNegative)
        {
            degrees += 180;
        }
        else if (!YIsNegative && XIsNegative)
        {
            degrees += 270;
        }

        return(degrees);
    }
コード例 #2
0
 // Update is called once per frame
 void Update()
 {
     m_Transform.localPosition = new Vector3(
         InputAbstraction.GetAxis(InputAbstraction.AxisAlias.X, hand, ignoreSDK) * amplitudeMaxX,
         m_Transform.localPosition.y,
         InputAbstraction.GetAxis(InputAbstraction.AxisAlias.Y, hand, ignoreSDK) * amplitudeMaxY);
 }