示例#1
0
    void Update()
    {
        if (m_Init == true)
        {
            // Multiply by scale value only if used
            if (UsePositionScale)
            {
                // Position
                if (UsePositionX)
                {
                    m_DestinationVirtualTracker.SetX(PositionScaleValue * m_SourceTracker.GetX());
                }
                // Inverting Unity Y and MiddleVR Z because of different coordinate systems
                if (UsePositionY)
                {
                    m_DestinationVirtualTracker.SetZ(PositionScaleValue * m_SourceTracker.GetZ());
                }
                // Inverting Unity Y and MiddleVR Z because of different coordinate systems
                if (UsePositionZ)
                {
                    m_DestinationVirtualTracker.SetY(PositionScaleValue * m_SourceTracker.GetY());
                }
            }
            else
            {
                // Position
                if (UsePositionX)
                {
                    m_DestinationVirtualTracker.SetX(m_SourceTracker.GetX());
                }
                // Inverting Unity Y and MiddleVR Z because of different coordinate systems
                if (UsePositionY)
                {
                    m_DestinationVirtualTracker.SetZ(m_SourceTracker.GetZ());
                }
                // Inverting Unity Y and MiddleVR Z because of different coordinate systems
                if (UsePositionZ)
                {
                    m_DestinationVirtualTracker.SetY(m_SourceTracker.GetY());
                }
            }

            // Orientation
            if (UseYaw)
            {
                m_DestinationVirtualTracker.SetYaw(m_SourceTracker.GetYaw());
            }
            if (UsePitch)
            {
                m_DestinationVirtualTracker.SetPitch(m_SourceTracker.GetPitch());
            }
            if (UseRoll)
            {
                m_DestinationVirtualTracker.SetRoll(m_SourceTracker.GetRoll());
            }
        }
    }
示例#2
0
    protected void Update()
    {
        if (m_IsInit)
        {
            float scale = 1.0f;

            if (UsePositionScale)
            {
                scale = PositionScaleValue;
            }

            // Position
            //
            // Show how coordinates values can be changed when feeding a virtual tracker.
            //
            if (UsePositionX)
            {
                m_DestinationVirtualTracker.SetX(scale * m_SourceTracker.GetX());
            }
            if (UsePositionY)
            {
                m_DestinationVirtualTracker.SetZ(scale * m_SourceTracker.GetZ());
            }
            if (UsePositionZ)
            {
                m_DestinationVirtualTracker.SetY(scale * m_SourceTracker.GetY());
            }

            // Orientation
            //
            // Note that it is suggested to use quaternions if you do not need
            // to decompose a rotation.
            //
            if (UseYaw)
            {
                m_DestinationVirtualTracker.SetYaw(m_SourceTracker.GetYaw());
            }
            if (UsePitch)
            {
                m_DestinationVirtualTracker.SetPitch(m_SourceTracker.GetPitch());
            }
            if (UseRoll)
            {
                m_DestinationVirtualTracker.SetRoll(m_SourceTracker.GetRoll());
            }
        }
    }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        if (m_Init == true)
        {
            m_Tracker.SetX(0.0f);
            m_Tracker.SetY(0.0f);
            m_Tracker.SetZ(0.0f);

            float yaw   = 0.0f;
            float pitch = MiddleVR.RadToDeg(Mathf.Asin(Mathf.Clamp(m_Wiimote.GetValue(2), -1, 1)));
            float roll  = MiddleVR.RadToDeg(Mathf.Asin(Mathf.Clamp(m_Wiimote.GetValue(1), -1, 1)));

            m_Tracker.SetYaw(yaw);
            m_Tracker.SetPitch(pitch);
            m_Tracker.SetRoll(roll);
        }
    }